新增 sharding-jdbc 实例

This commit is contained in:
Administrator
2020-10-30 12:34:02 +08:00
parent ce35fe7aac
commit fb945b16d9
11 changed files with 230 additions and 71 deletions

View File

@ -0,0 +1,50 @@
spring:
shardingsphere:
datasource:
names: ds0, ds0slave1, ds0slave2, ds1
ds0:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://125.32.114.204:13306/ebtp-cloud?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: mall3-ebtp-dev
password: mall3-ebtp-dev
# 从库
ds0slave1:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://125.32.114.204:13306/ebtp-cloud?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: mall3-ebtp-dev
password: mall3-ebtp-dev
ds0slave2:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://125.32.114.204:13306/ebtp-cloud?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: mall3-ebtp-dev
password: mall3-ebtp-dev
ds1:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://125.32.114.204:13306/ebtp_mall_evaluation?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
username: mall3-ebtp-dev
password: mall3-ebtp-dev
# 分库配置
sharding:
tables:
demo:
actual-data-nodes: ds0.demo
undo_log:
actual-data-nodes: ds1.undo_log
#读写分离
master-slave-rules:
ds0:
master-data-source-name: ds0
slave-data-source-names:
- ds0slave1
- ds0slave2

View File

@ -0,0 +1,10 @@
spring:
profiles:
active: shardingJdbc
application:
name: mall-ebtp-cloud-demo
logging:
level:
root: info