lookbroad-serve/src/main/resources/application-dev.yml

107 lines
4.9 KiB
YAML
Raw Normal View History

2022-05-17 21:39:00 +08:00
#dev环境 mysql7.0
spring:
datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
#druid连接池配置
druid:
#主库数据源
master:
url: jdbc:mysql://localhost:3306/goview_v2?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false&serverTimezone=GMT
username: root
password: root
#备数据源 #关闭
slave:
enabled: false
url: jdbc:mysql://localhost:3306/springbootv3?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT&autoReconnect=true&useSSL=false
username: root
password: root
#配置初始化连接数大小
initial-size: 10
# 最大连接数
maxActive: 50
#最小连接数
minIdle: 10
#获取连接等待超时时间
maxWait: 5000
poolPreparedStatements: true #是否缓存preparedStatement也就是PSCache。PSCache对支持游标的数据库性能提升巨大比如说oracle。在mysql下建议关闭。
maxPoolPreparedStatementPerConnection-size: 20
validationQuery: SELECT 1 FROM DUAL
validationQueryTimeout: 20000
testOnBorrow: false #申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。
testOnReturn: false #归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。
testWhileIdle: true #建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。
timeBetweenEvictionRunsMillis: 60000 #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
minEvictableIdleTimeMillis: 300000 #一个连接在池中最小生存的时间,单位是毫秒
maxEvictableIdleTimeMillis: 900000 # 配置一个连接在池中最大生存的时间,单位是毫秒
#StatViewServlet配置。因为暴露的监控信息比较敏感支持密码加密和访问ip限定
webStatFilter:
enabled: true
statViewServlet:
enabled: true
urlPattern: /druid/*
#可以增加访问账号密码【去掉注释就可以】
#login-username: admin
#login-password: admin
filter:
stat:
enabled: true
# 慢SQL记录
log-slow-sql: true
slow-sql-millis: 1000
merge-sql: true
wall:
config:
multi-statement-allow: true
#mysql 8.0
#spring:
# datasource:
# type: com.alibaba.druid.pool.DruidDataSource
# driverClassName: com.mysql.cj.jdbc.Driver
# #druid连接池配置
# druid:
# # 主库数据源
# master:
# url: jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT&autoReconnect=true&useSSL=false
# username: root
# password: root
# #树熊数据源
# slave:
# enabled : false
# url: jdbc:mysql://localhost:3306/test2?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT&autoReconnect=true&useSSL=false
# username: root
# password: root
# #配置初始化连接数大小
# initial-size: 10
# # 最大连接数
# max-active: 50
# #最小连接数
# min-idle: 10
# #获取连接等待超时时间
# max-wait: 5000
# pool-prepared-statements: true #是否缓存preparedStatement也就是PSCache。PSCache对支持游标的数据库性能提升巨大比如说oracle。在mysql下建议关闭。
# max-pool-prepared-statement-per-connection-size: 20
# validation-query: SELECT 1 FROM DUAL
# validation-query-timeout: 20000
# test-on-borrow: false #申请连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。
# test-on-return: false #归还连接时执行validationQuery检测连接是否有效做了这个配置会降低性能。
# test-while-idle: true #建议配置为true不影响性能并且保证安全性。申请连接的时候检测如果空闲时间大于timeBetweenEvictionRunsMillis执行validationQuery检测连接是否有效。
# time-between-eviction-runs-millis: 60000 #配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
# min-evictable-idle-time-millis: 300000 #一个连接在池中最小生存的时间,单位是毫秒
# #StatViewServlet配置。因为暴露的监控信息比较敏感支持密码加密和访问ip限定
# stat-view-servlet:
# enabled: true
# url-pattern: /druid/*
# #可以增加访问账号密码【去掉注释就可以】
# #login-username: admin
# #login-password: admin
# filter:
# stat:
# log-slow-sql: true
# slow-sql-millis: 1000
# merge-sql: true
# wall:
# config:
# multi-statement-allow: true