sharding-sphere5/service/src/main/resources/application.yml

72 lines
2.6 KiB
YAML
Raw Normal View History

2024-07-28 03:13:27 +08:00
server:
port: 8800
spring:
main:
allow-bean-definition-overriding: true
2024-07-28 03:13:27 +08:00
profiles:
active: @profiles.active@
application:
name: bunny-service
# datasource:
# # driver-class-name: org.apache.shardingsphere.driver.ShardingSphereDriver
# # url: jdbc:shardingsphere:classpath:static/shardingsphere.yaml
# # type: com.zaxxer.hikari.HikariDataSource
2024-07-28 20:37:03 +08:00
# driver-class-name: com.mysql.cj.jdbc.Driver
# url: jdbc:mysql://${bunny.master.host}:${bunny.master.port}/${bunny.master.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
# username: ${bunny.master.username}
# password: ${bunny.master.password}
shardingsphere:
datasource:
names: master, slave1, slave2
master:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://${bunny.master.host}:${bunny.master.port}/${bunny.master.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
username: ${bunny.master.username}
password: ${bunny.master.password}
slave1:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://${bunny.slave1.host}:${bunny.slave1.port}/${bunny.slave1.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
username: ${bunny.slave1.username}
password: ${bunny.slave1.password}
slave2:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://${bunny.slave2.host}:${bunny.slave2.port}/${bunny.slave2.sqlData}?serverTimezone=GMT%2B8&useSSL=false&characterEncoding=utf-8&allowPublicKeyRetrieval=true
username: ${bunny.slave2.username}
password: ${bunny.slave2.password}
rules:
readwrite-splitting:
data-sources:
readwrite_ds:
static-strategy:
write-data-source-name: master
read-data-source-names: slave1, slave2
load-balancer-name: round_robin
load-balancers:
round_robin:
type: ROUND_ROBIN
sharding:
default-database-strategy:
hint:
sharding-algorithm-name: master
2024-07-28 03:13:27 +08:00
jackson:
date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8
2024-07-28 03:13:27 +08:00
mybatis-plus:
mapper-locations: classpath:mapper/*.xml
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 查看日志
logging:
pattern:
dateformat: HH:mm:ss:SSS
file:
path: "logs/${spring.application.name}"