|
@@ -4,13 +4,11 @@ server:
|
|
|
--- #################### 数据库相关配置 ####################
|
|
|
|
|
|
spring:
|
|
|
- # 数据源配置项 TODO 多数据源;TODO 监控配置
|
|
|
+ # 数据源配置项 TODO 监控配置
|
|
|
+ # 排除默认的自动配置,使用dynamic-datasource-spring-boot-starter配置多数据源,整合druid
|
|
|
+ autoconfigure:
|
|
|
+ exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
|
|
datasource:
|
|
|
- name: ruoyi-vue-pro
|
|
|
- url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.name}?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
|
|
|
- driver-class-name: com.mysql.jdbc.Driver
|
|
|
- username: root
|
|
|
- password: 123456
|
|
|
druid:
|
|
|
web-stat-filter:
|
|
|
enabled: true
|
|
@@ -32,6 +30,32 @@ spring:
|
|
|
wall:
|
|
|
config:
|
|
|
multi-statement-allow: true
|
|
|
+ dynamic:
|
|
|
+ # druid全局配置 https://dynamic-datasource.com/en/guide/integration/Druid.html#configurate-parameters
|
|
|
+# druid: #The following are the supported global parameters
|
|
|
+# initial-size:
|
|
|
+# max-active:
|
|
|
+# min-idle:
|
|
|
+# max-wait:
|
|
|
+ primary: master
|
|
|
+ datasource:
|
|
|
+ master:
|
|
|
+ name: ruoyi-vue-pro
|
|
|
+ url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
|
|
|
+ driver-class-name: com.mysql.jdbc.Driver
|
|
|
+ username: root
|
|
|
+ password: 123456
|
|
|
+ # druid 局部配置
|
|
|
+# druid: # The following are independent parameters that can be reset for each db
|
|
|
+# validation-query: select 1 FROM DUAL #such as oracle need this
|
|
|
+# slave:
|
|
|
+# name: ruoyi-vue-pro-slave
|
|
|
+# url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT
|
|
|
+# driver-class-name: com.mysql.jdbc.Driver
|
|
|
+# username: root
|
|
|
+# password: 123456
|
|
|
+
|
|
|
+
|
|
|
|
|
|
# Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优
|
|
|
redis:
|
|
@@ -77,9 +101,9 @@ apollo:
|
|
|
eagerLoad:
|
|
|
enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置
|
|
|
jdbc: # 自定义的 JDBC 配置项,用于数据库的地址
|
|
|
- url: ${spring.datasource.url}
|
|
|
- username: ${spring.datasource.username}
|
|
|
- password: ${spring.datasource.password}
|
|
|
+ url: ${spring.datasource.dynamic.datasource.master.url}
|
|
|
+ username: ${spring.datasource.dynamic.datasource.master.username}
|
|
|
+ password: ${spring.datasource.dynamic.datasource.master.password}
|
|
|
|
|
|
--- #################### 服务保障相关配置 ####################
|
|
|
|
|
@@ -161,3 +185,11 @@ yudao:
|
|
|
exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系
|
|
|
- ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求
|
|
|
- ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|