提交 b6dfbdf4 authored 作者: 陈世营's avatar 陈世营

update sharding jdbc version

上级 6efc7e6e
...@@ -4,19 +4,25 @@ server: ...@@ -4,19 +4,25 @@ server:
spring: spring:
application: application:
name: loit-shardingshere name: loit-shardingshere
cloud:
nacos:
discovery:
# Nacos 注册中心地址
server-addr: 39.100.254.140:8103
namespace: 3ac84119-5558-4bf8-b309-034dd0e458e0
aop: #使用CGLIB来实现AOP的时候 aop: #使用CGLIB来实现AOP的时候
proxy-target-class: true proxy-target-class: true
shardingsphere: shardingsphere:
datasource: datasource:
names: ds0,ds1 names: ds-master,ds-slave-0
ds0: ds-master:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
# type: com.zaxxer.hikari.HikariDataSource # type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: abcd1234A! password: loit2019ABC
jdbc-url: jdbc:mysql://39.98.202.173:3306/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC jdbc-url: jdbc:mysql://192.168.66.40:3321/demo_ds?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
url: jdbc:mysql://39.98.202.173:3306/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC url: jdbc:mysql://192.168.66.40:3321/demo_ds?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
filters: stat,wall,log4j filters: stat,wall,log4j
maxActive: 20 maxActive: 20
initialSize: 1 initialSize: 1
...@@ -31,14 +37,14 @@ spring: ...@@ -31,14 +37,14 @@ spring:
poolPreparedStatements: true poolPreparedStatements: true
maxOpenPreparedStatements: 20 maxOpenPreparedStatements: 20
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000 connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
ds1: ds-slave-0:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
# type: com.zaxxer.hikari.HikariDataSource # type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.jdbc.Driver driver-class-name: com.mysql.jdbc.Driver
username: root username: root
password: abcd1234A! password: loit2019ABC
jdbc-url: jdbc:mysql://39.98.202.173:3306/demo_ds_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC jdbc-url: jdbc:mysql://192.168.66.40:3321/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
url: jdbc:mysql://39.98.202.173:3306/demo_ds_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC url: jdbc:mysql://192.168.66.40:3321/demo_ds_0?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
filters: stat,wall,log4j filters: stat,wall,log4j
maxActive: 20 maxActive: 20
initialSize: 1 initialSize: 1
...@@ -53,34 +59,12 @@ spring: ...@@ -53,34 +59,12 @@ spring:
poolPreparedStatements: true poolPreparedStatements: true
maxOpenPreparedStatements: 20 maxOpenPreparedStatements: 20
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000 connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
sharding: masterslave:
default-database-strategy: load-balance-algorithm-type: round_robin
inline: name: ds_ms
sharding-column: user_id master-data-source-name: ds-master
algorithm-expression: ds$->{user_id % 2} #slave-data-source-names: ds-slave-0,ds-slave-1
tables: slave-data-source-names: ds-slave-0
t_order:
actual-data-nodes: ds$->{0..1}.t_order_$->{0..1}
table-strategy:
inline:
sharding-column: order_id
algorithm-expression: t_order_$->{order_id % 2}
key-generator:
column: order_id
type: SNOWFLAKE
props:
worker.id: 123
t_order_item:
actual-data-nodes: ds$->{0..1}.t_order_item_$->{0..1}
table-strategy:
inline:
sharding-column: order_id
algorithm-expression: t_order_item_$->{order_id % 2}
key-generator:
column: order_item_id
type: SNOWFLAKE
props:
worker.id: 123
#mybatis: #mybatis:
# mapper-locations: classpath:/mapper/**/*.xml #把xml文件放在com.XX.mapper.*中可能会出现找到的问题,这里把他放在resource下的mapper中 # mapper-locations: classpath:/mapper/**/*.xml #把xml文件放在com.XX.mapper.*中可能会出现找到的问题,这里把他放在resource下的mapper中
...@@ -94,7 +78,7 @@ mybatis-plus: ...@@ -94,7 +78,7 @@ mybatis-plus:
# datasource: dataSource # datasource: dataSource
mapper-locations: classpath:/mapper/**/*.xml mapper-locations: classpath:/mapper/**/*.xml
#实体扫描,多个package用逗号或者分号分隔 #实体扫描,多个package用逗号或者分号分隔
type-aliases-package: com.loit.shardingsphere.seata.nacos.feign.modules type-aliases-package: com.loit.shardingsphere.seata.modules.entity
#typeEnumsPackage: com.baomidou.springboot.entity.enums #typeEnumsPackage: com.baomidou.springboot.entity.enums
global-config: global-config:
#主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID", 4:"该类型为未设置主键类型", 5:"字符串全局唯一ID"; #主键类型 0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID", 4:"该类型为未设置主键类型", 5:"字符串全局唯一ID";
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论