druid mysql 最佳配置_Druid推荐配置

Durid 和SpringBoot整合配置

## spring配置

spring:

datasource:

druid:

driver-class-name: com.mysql.cj.jdbc.Driver

type: com.alibaba.druid.pool.DruidDataSource

url: jdbc:mysql://127.0.0.1:10086/db_druid?characterEncoding=UTF-8&autoReconnect=true&zeroDateTimeBehavior=convertToNull&useUnicode=true&serverTimezone=Hongkong

username: dly

password: mima

# 以下是druid的配置

# 最大存活

max-active: 20

# 初始化连接个数

initial-size: 1

# 最小连接个数

min-idle: 1

# 最大等待时间

max-wait: 10000

# 间隔多久检测需要关闭空闲连接

time-between-eviction-runs-millis: 60000

# 连接在池中最小生存是时间

min-evictable-idle-time-millis: 300000

# 检测空闲连接是否有效

keep-alive: true

# 测试sql

validation-query: select 1

validation-query-timeout: 3

async-init: true

# 监控配置

filters: stat,slf4j,wall

filter:

stat:

enabled: true

db-type: mysql

log-slow-sql: true

# 执行超过5S就会打印SQL

slow-sql-millis: 5000

slf4j:

enabled: true

connection-log-enabled: true

statement-sql-pretty-format: true

wall:

enabled: true

log-violation: true

config:

# 检查是否无where条件

delete-where-none-check: true

update-where-none-check: true

truncate-allow: false

alter-table-allow: false

drop-table-allow: false

web-stat-filter:

enabled: true

url-pattern: /*

exclusions: '*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*'

session-stat-enable: false

stat-view-servlet:

enabled: true

url-pattern: /druid/*

reset-enable: false

login-username: druid

login-password: 123456

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值