配置多个从库
This commit is contained in:
84
src/main/resources/application-111.yml
Normal file
84
src/main/resources/application-111.yml
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
# 数据源的一些配置
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
# 最小空闲连接,默认值10,小于0或大于maximum-pool-size,都会重置为maximum-pool-size
|
||||||
|
minimum-idle: 5
|
||||||
|
# 最大连接数,小于等于0会被重置为默认值10;大于零小于1会被重置为minimum-idle的值
|
||||||
|
maximum-pool-size: 15
|
||||||
|
# 空闲连接超时时间,默认值600000(10分钟),大于等于max-lifetime且max-lifetime>0,会被重置为0;不等于0且小于10秒,会被重置为10秒。
|
||||||
|
idle-timeout: 30000
|
||||||
|
# 连接最大存活时间.不等于0且小于30秒,会被重置为默认值30分钟.设置应该比mysql设置的超时时间短
|
||||||
|
max-lifetime: 30000
|
||||||
|
# 连接超时时间:毫秒,小于250毫秒,否则被重置为默认值30秒
|
||||||
|
connection-timeout: 30000
|
||||||
|
|
||||||
|
spring:
|
||||||
|
# sharding-jdbc 配置
|
||||||
|
shardingsphere:
|
||||||
|
center-tables-data-node: duanju.%s
|
||||||
|
# 显示sharding-jdbc改写的sql语句
|
||||||
|
show-sql: false
|
||||||
|
# 数据源名称
|
||||||
|
datasource:
|
||||||
|
# 数据源配置begin
|
||||||
|
master-0:
|
||||||
|
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
|
||||||
|
# jdbc-url: jdbc:mysql://rm-gc7xx913734hv5w5qxo.mysql.cn-chengdu.rds.aliyuncs.com/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||||
|
username: video_user
|
||||||
|
password: VideoUser@1
|
||||||
|
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: jdbc:mysql://localhost:3306/duanju?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=CTT
|
||||||
|
# jdbc-url: jdbc:mysql://47.122.73.144: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
|
||||||
|
# jdbc-url: jdbc:mysql://47.122.30.120: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}
|
||||||
|
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
|
||||||
|
# jdbc-url: jdbc:mysql://47.122.74.162: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}
|
||||||
|
# 数据源配置end
|
||||||
|
|
||||||
|
# 读写分离配置begin
|
||||||
|
master-slave-rules:
|
||||||
|
#数据源
|
||||||
|
duanju:
|
||||||
|
master-data-source-name: master-0
|
||||||
|
slave-data-source-names: slave-0,slave-1,slave-2
|
||||||
|
# - slave-0
|
||||||
|
# - slave-1
|
||||||
|
# - slave-2
|
||||||
|
|
||||||
|
swagger:
|
||||||
|
enabled: false
|
||||||
|
pay:
|
||||||
|
h5BaseUrl: https://dj-h5.hnsiyao.cn/me/detail/detail?allId=
|
||||||
|
orderNotifyUrl: https://pay.hnsiyao.cn/czg/app/wuyou/notify
|
||||||
|
extractNotifyUrl: https://pay.hnsiyao.cn/czg/app/wuyou/extractNotify
|
||||||
@@ -40,6 +40,26 @@ spring:
|
|||||||
idle-timeout: ${idle-timeout}
|
idle-timeout: ${idle-timeout}
|
||||||
max-lifetime: ${max-lifetime}
|
max-lifetime: ${max-lifetime}
|
||||||
connection-timeout: ${connection-timeout}
|
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}
|
||||||
|
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@
|
||||||
|
minimum-idle: ${minimum-idle}
|
||||||
|
maximum-pool-size: ${maximum-pool-size}
|
||||||
|
idle-timeout: ${idle-timeout}
|
||||||
|
max-lifetime: ${max-lifetime}
|
||||||
|
connection-timeout: ${connection-timeout}
|
||||||
# 数据源配置end
|
# 数据源配置end
|
||||||
|
|
||||||
# 读写分离配置begin
|
# 读写分离配置begin
|
||||||
@@ -47,9 +67,10 @@ spring:
|
|||||||
#数据源
|
#数据源
|
||||||
duanju:
|
duanju:
|
||||||
master-data-source-name: master-0
|
master-data-source-name: master-0
|
||||||
slave-data-source-names: slave-0
|
slave-data-source-names: slave-0,slave-1,slave-2
|
||||||
# - master-0
|
|
||||||
# - slave-0
|
# - slave-0
|
||||||
|
# - slave-1
|
||||||
|
# - slave-2
|
||||||
|
|
||||||
swagger:
|
swagger:
|
||||||
enabled: false
|
enabled: false
|
||||||
|
|||||||
Reference in New Issue
Block a user