分4库 配置文件
prod 分库 其它环境不分库
This commit is contained in:
@@ -21,13 +21,24 @@ connection-timeout: 30000
|
||||
spring:
|
||||
# sharding-jdbc 配置
|
||||
shardingsphere:
|
||||
center-tables-data-node: duanju.%s
|
||||
# 显示sharding-jdbc改写的sql语句
|
||||
show-sql: false
|
||||
|
||||
center-tables-data-node: duanju.%s
|
||||
# 区域表的数据源节点
|
||||
region-tables-data-node: duanju-$->{0..4}.%s
|
||||
# 区域分库策略的计算字段
|
||||
region-tables-sharding-database-column: user_id
|
||||
# 分库的计算方法
|
||||
region-tables-sharding-database-algorithm: duanju-$->{Math.abs(user_id) % 5}
|
||||
|
||||
# 短剧集表 拆分
|
||||
course_details-sharding-database-column: course_id
|
||||
course_details-sharding-database-algorithm: duanju-$->{Math.abs(course_id) % 5}
|
||||
|
||||
# 数据源名称
|
||||
datasource:
|
||||
# 数据源配置begin
|
||||
master-0:
|
||||
master:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://rm-gc7xx913734hv5w5q.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: video_user
|
||||
@@ -37,31 +48,112 @@ spring:
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
# slave-0:
|
||||
# driver-class-name: ${driver-class-name}
|
||||
# jdbc-url: jdbc:mysql://localhost:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: acddb0c84a192ada
|
||||
# minimum-idle: ${minimum-idle}
|
||||
# maximum-pool-size: ${maximum-pool-size}
|
||||
# idle-timeout: ${idle-timeout}
|
||||
# max-lifetime: ${max-lifetime}
|
||||
# connection-timeout: ${connection-timeout}
|
||||
# slave-1:
|
||||
# driver-class-name: ${driver-class-name}
|
||||
# jdbc-url: jdbc:mysql://172.18.96.9:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
# username: root
|
||||
# password: VideoUser1@
|
||||
# minimum-idle: ${minimum-idle}
|
||||
# maximum-pool-size: ${maximum-pool-size}
|
||||
# idle-timeout: ${idle-timeout}
|
||||
# max-lifetime: ${max-lifetime}
|
||||
# connection-timeout: ${connection-timeout}
|
||||
# 数据源配置begin
|
||||
master-0:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
master-1:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
master-2:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
master-3:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
master-4:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-0:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-1:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-2:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url: jdbc:mysql://172.18.96.8:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||
username: root
|
||||
password: VideoUser1@
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-3:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
max-lifetime: ${max-lifetime}
|
||||
connection-timeout: ${connection-timeout}
|
||||
slave-4:
|
||||
driver-class-name: ${driver-class-name}
|
||||
jdbc-url:
|
||||
username:
|
||||
password:
|
||||
minimum-idle: ${minimum-idle}
|
||||
maximum-pool-size: ${maximum-pool-size}
|
||||
idle-timeout: ${idle-timeout}
|
||||
@@ -73,9 +165,21 @@ spring:
|
||||
master-slave-rules:
|
||||
#数据源
|
||||
duanju:
|
||||
master-data-source-name: master
|
||||
slave-data-source-names: slave
|
||||
duanju-0:
|
||||
master-data-source-name: master-0
|
||||
# slave-data-source-names: slave-0,slave-1,slave-2
|
||||
slave-data-source-names: slave-0
|
||||
duanju-1:
|
||||
master-data-source-name: master-1
|
||||
slave-data-source-names: slave-1
|
||||
duanju-2:
|
||||
master-data-source-name: master-2
|
||||
slave-data-source-names: slave-2
|
||||
# - slave-0
|
||||
# - slave-1
|
||||
# - slave-2
|
||||
duanju-3:
|
||||
master-data-source-name: master-3
|
||||
slave-data-source-names: slave-3
|
||||
duanju-4:
|
||||
master-data-source-name: master-4
|
||||
slave-data-source-names: slave-4
|
||||
|
||||
|
||||
Reference in New Issue
Block a user