增加数据库主备自动切换功能

This commit is contained in:
wanggeng 2021-11-29 15:44:27 +08:00
parent dc688f1e5f
commit ce1bdc85a8
2 changed files with 3 additions and 1 deletions

View File

@ -53,6 +53,7 @@
<artifactId>druid-spring-boot-starter</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>

View File

@ -27,11 +27,12 @@ spring:
datasource:
druid:
url: jdbc:mysql://127.0.0.1:3306/db_smart_city_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true
# standby-url: jdbc:mysql://192.168.0.151:3306/db_smart_city_usercenter?useUnicode=true&characterEncoding=utf8&characterSetResults=utf8&autoReconnect=true&failOverReadOnly=false&useSSL=false&serverTimezone=UTC&nullCatalogMeansCurrent=true
db-type: mysql
driver-class-name: com.mysql.cj.jdbc.Driver
username: root
password: root
initial-size: 2
initial-size: 1
min-idle: 2
max-active: 5
max-wait: 60000