当前位置: 首页 > news >正文

重庆蒲公英网站建设公司dede网站301怎么做

重庆蒲公英网站建设公司,dede网站301怎么做,网站建设公司包括哪些,注册公司需要什么费用需求#xff1a; 分库#xff1a;按业务线business_id将不同业务线的订单存储在不同的数据库上#xff1b; 分表#xff1a;按user_id字段将不同用户的订单存储在不同的表上#xff0c;为方便直接用非分片字段order_id查询#xff0c;可使用基因法#xff1b; 读写分离 分库按业务线business_id将不同业务线的订单存储在不同的数据库上 分表按user_id字段将不同用户的订单存储在不同的表上为方便直接用非分片字段order_id查询可使用基因法 读写分离为缓解主库的压力读操作访问从库 库表SQL -- 主库 CREATE DATABASE database_103; CREATE DATABASE database_112;-- 从库 CREATE DATABASE database_slave_103; CREATE DATABASE database_slave_112;--每个库上分别建立如下表 CREATE TABLE t_order_0 (id bigint(20) NOT NULL,order_id bigint(20) NOT NULL,user_id bigint(20) NOT NULL,business_id bigint(20) NOT NULL ) ENGINEInnoDB DEFAULT CHARSETutf8;CREATE TABLE t_order_1 (id bigint(20) NOT NULL,order_id bigint(20) NOT NULL,user_id bigint(20) NOT NULL,business_id bigint(20) NOT NULL ) ENGINEInnoDB DEFAULT CHARSETutf8;CREATE TABLE t_order_2 (id bigint(20) NOT NULL,order_id bigint(20) NOT NULL,user_id bigint(20) NOT NULL,business_id bigint(20) NOT NULL ) ENGINEInnoDB DEFAULT CHARSETutf8; INSERT INTO t_order VALUES (1,1,112);CREATE TABLE t_order_3 (id bigint(20) NOT NULL,order_id bigint(20) NOT NULL,user_id bigint(20) NOT NULL,business_id bigint(20) NOT NULL ) ENGINEInnoDB DEFAULT CHARSETutf8; pom.xml !-- sharding-jdbc --dependencygroupIdcom.dangdang/groupIdartifactIdsharding-jdbc-core/artifactIdversion1.4.2/version/dependencydependencygroupIdcom.dangdang/groupIdartifactIdsharding-jdbc-config-spring/artifactIdversion1.4.0/version/dependency spring-database.xml ?xml version1.0 encodingUTF-8? beans xmlnshttp://www.springframework.org/schema/beansxmlns:xsihttp://www.w3.org/2001/XMLSchema-instancexmlns:txhttp://www.springframework.org/schema/txxmlns:rdbhttp://www.dangdang.com/schema/ddframe/rdbxsi:schemaLocationhttp://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans.xsdhttp://www.springframework.org/schema/txhttp://www.springframework.org/schema/tx/spring-tx.xsdhttp://www.dangdang.com/schema/ddframe/rdbhttp://www.dangdang.com/schema/ddframe/rdb/rdb.xsdbean iddatabase_112 classcom.alibaba.druid.pool.DruidDataSource init-methodinitdestroy-methodcloseproperty namedriverClassName valuecom.mysql.jdbc.Driver/property nameurl value${jdbc.url.112}/propertyproperty nameusername value${jdbc.username.112}/propertyproperty namepassword value${jdbc.password.112}/propertyproperty namemaxActive value100/property nameinitialSize value50/property namemaxWait value60000/property nameminIdle value5//beanbean iddatabase_slave_112 classcom.alibaba.druid.pool.DruidDataSource init-methodinitdestroy-methodcloseproperty namedriverClassName valuecom.mysql.jdbc.Driver/property nameurl value${jdbc.url.slave.112}/propertyproperty nameusername value${jdbc.username.slave.112}/propertyproperty namepassword value${jdbc.password.slave.112}/propertyproperty namemaxActive value100/property nameinitialSize value50/property namemaxWait value60000/property nameminIdle value5//beanbean iddatabase_103 classcom.alibaba.druid.pool.DruidDataSource init-methodinitdestroy-methodcloseproperty namedriverClassName valuecom.mysql.jdbc.Driver/property nameurl value${jdbc.url.103}/propertyproperty nameusername value${jdbc.username.103}/propertyproperty namepassword value${jdbc.password.103}/propertyproperty namemaxActive value100/property nameinitialSize value50/property namemaxWait value60000/property nameminIdle value5//beanbean iddatabase_slave_103 classcom.alibaba.druid.pool.DruidDataSource init-methodinitdestroy-methodcloseproperty namedriverClassName valuecom.mysql.jdbc.Driver/property nameurl value${jdbc.url.slave.103}/propertyproperty nameusername value${jdbc.username.slave.103}/propertyproperty namepassword value${jdbc.password.slave.103}/propertyproperty namemaxActive value100/property nameinitialSize value50/property namemaxWait value60000/property nameminIdle value5//bean!--mybatis--bean idsqlSessionFactory classorg.mybatis.spring.SqlSessionFactoryBeanproperty namemapperLocations valueclasspath:xmlmapper/*.xml/property namedataSource refshardingDataSource/!-- 配置Mybatis配置文件 --property nameconfigLocation valueclasspath:/mybatis/mybatis-config.xml//beanbean idsqlSession classorg.mybatis.spring.SqlSessionTemplateconstructor-arg index0 refsqlSessionFactory//bean!-- 注解Mapper scanner --bean classorg.mybatis.spring.mapper.MapperScannerConfigurerproperty namebasePackage valuecom.lc.sharding.mybatismapper/property namesqlSessionTemplateBeanName valuesqlSession//bean!-- 事务--bean idtxManagerclassorg.springframework.jdbc.datasource.DataSourceTransactionManagerproperty namedataSource refshardingDataSource//beantx:annotation-driven transaction-managertxManager/!--读写分离--rdb:master-slave-data-source idrbb_112 master-data-source-refdatabase_112slave-data-sources-refdatabase_slave_112/rdb:master-slave-data-source idrbb_103 master-data-source-refdatabase_103slave-data-sources-refdatabase_slave_103/!--分库策略--rdb:strategy iddatabaseShardingStrategy sharding-columnsbusiness_idalgorithm-expressionrbb_${business_id.longValue()}/!--分表策略--rdb:strategy idtableShardingStrategy sharding-columnsuser_id,order_idalgorithm-classcom.lc.sharding.algorithm.MultipleKeysTableShardingAlgorithmImpl/rdb:data-source idshardingDataSourcerdb:sharding-rule data-sourcesrbb_112,rbb_103rdb:table-rulesrdb:table-rule logic-tablet_order actual-tablest_order_${0..3} database-strategydatabaseShardingStrategytable-strategytableShardingStrategy//rdb:table-rules/rdb:sharding-rulerdb:propsprop keymetrics.enabletrue/propprop keysql.showtrue/prop/rdb:props/rdb:data-source /beans 基因法多列分片 public class MultipleKeysTableShardingAlgorithmImpl implements MultipleKeysTableShardingAlgorithm {public CollectionString doSharding(CollectionString tableNames, CollectionShardingValue? shardingValues) {ListString shardingSuffix new ArrayListString();long partId 0;for (ShardingValue value : shardingValues) {if (value.getColumnName().equals(user_id)) {partId ((Long) value.getValue()) % 4;break;} else if (value.getColumnName().equals(order_id)) {partId ((Long) value.getValue()) % 4;break;}}for (String name : tableNames) {if (name.endsWith(partId )) {shardingSuffix.add(name);return shardingSuffix;}}return shardingSuffix;} } 什么是基因法分片 在订单数据oid生成时order_id末端加入分片基因让同一个user_id下的所有订单都含有相同基因落在同一个表上。 资料https://mp.weixin.qq.com/s/PCzRAZa9n4aJwHOX-kAhtA 根据user_id生成order_id: public long bulidOrderId(long userId) {//取用户id后4位userId userId 15;//先取60位唯一idlong uniqueId this.nextId();//唯一id左移4位、拼接userId后4位return (uniqueId 4) | userId;} this.nextId();//使用雪花算法生成60位分布式唯一id1位符号位41位时间戳5位workId5位datacenterId6位序列号4位基因片  小结 数据分片 支持分库分表可支持 BETWEENIN等多维度分片也支持多分片键共用支持聚合分组排序分页关联等复杂查询语句分片灵活支持多分片键共用支持inline表达式基于Hint的强制路由支持分布式主键读写分离 支持一主多从的读写分离支持分库分表与读写分离共同使用支持分布式生成全局主键。柔性事务 最大努力到达型事务分布式治理 支持配置中心可动态修改支持客户端熔断和失效转移引用http://shardingsphere.io/转载于:https://www.cnblogs.com/sidesky/p/10669403.html
http://www.zqtcl.cn/news/776175/

相关文章:

  • 网站建设的常见技术有哪些方面网站联系我们模块怎么做
  • 外贸网站建设专业上海四大设计院是哪四个
  • 太原网站设计排名维启网站建设
  • 电子商务网站建设基本流程图网站建设推广策划
  • 合肥集团网站建设哪个好果洛电子商务网站建设哪家好
  • 顺德高端网站企业建设网站没有服务器
  • .net网站开发模板天津手网站开发
  • 网页设计大赛网站开发重庆最近的新闻大事10条
  • 网站ftp用户名和密码是什么建设单位网站设计
  • 公司请人做的网站打不开网页游戏大厅都有哪些
  • 网投网站制作中国建设教育协会报名网站
  • 做外贸需要做网站吗上海中建建筑设计院有限公司
  • 网站源代码免费下载苏州seo网络优化公司
  • 建网站跟建网店的区别pico笔克品牌介绍
  • 网站设计小技巧西安网站建设网站
  • 做听书网站怎么做网站留言板带后台模板
  • 石家庄网站建设王道下拉棒厦门橄榄网站建设
  • 赤峰网站建设培训建筑资格证书查询官网
  • 共和县公司网站建设seo网络推广招聘
  • 网站怎样做外链百度网站地图提交
  • 瑞安联科网站建设中国做网站公司排名
  • jsp网站开发详解 赵增敏jsp网站首页怎么做
  • 有哪些可以做图的网站啊莱芜金点子广告电子版2024
  • 免费营销型网站模版南宁比较有好的网站制作公司
  • 做外贸上什么网站什么什么设计英文网站
  • 嘿客免费网站建设网站对联图片
  • 一件代发48个货源网站韶关最新消息
  • 网站都需要备案吗安徽建设通网站
  • 外包公司 网站建设 深圳电子商务公司设计网站建设
  • 怎么添加网站背景音乐定制建站