zcloud-gbs-primeport/start/src/main/resources/ds.yml

55 lines
2.4 KiB
YAML
Raw Normal View History

spring:
datasource:
mysql:
url: jdbc:mysql://${mysql.host}:${mysql.port}/${mysql.db}?characterEncoding=UTF-8&useUnicode=true&useSSL=false&tinyInt1isBit=false&allowPublicKeyRetrieval=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: ${mysql.username}
password: ${mysql.password}
type: com.alibaba.druid.pool.DruidDataSource
# 降级
# driver-class-name: com.mysql.cj.jdbc.Driver
driver-class-name: com.mysql.jdbc.Driver
initial-size: 6
min-idle: 1
maxActive: 100
# 配置获取连接等待超时的时间
maxWait: 60000
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
timeBetweenEvictionRunsMillis: 60000
# 配置一个连接在池中最小生存的时间,单位是毫秒
minEvictableIdleTimeMillis: 300000
#Oracle需要打开注释
#validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
# 打开PSCache并且指定每个连接上PSCache的大小
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
# 配置监控统计拦截的filters去掉后监控界面sql无法统计'wall'用于防火墙
filters: stat,slf4j
# 通过connectProperties属性来打开mergeSql功能慢SQL记录
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
wall:
multi-statement-allow: true
pgsql:
type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: org.postgresql.Driver # PG专属驱动
url: jdbc:postgresql://39.100.115.58:15431/postgres?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username: postgres
password: DjIGYM8k0h
# PG专属Druid配置适配PG特性统一为驼峰格式匹配原有风格
initial-size: 6
min-idle: 1
maxActive: 100
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
validationQuery: SELECT 1 # PG必须配置连接检测语句MySQL可省略
filters: stat,slf4j # PG不兼容wall过滤器需移除
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000