阿里巴巴 Druid 数据库连接池监控界面配置的参数解读
druid
阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
项目地址:https://gitcode.com/gh_mirrors/druid/druid

·
阿里巴巴 Druid 数据库连接池监控界面配置的参数解读
1.可选的配置项
druid
阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
项目地址:https://gitcode.com/gh_mirrors/druid/druid
Property Name | Default Value | Remarks |
---|---|---|
name | 存在多个数据源的时候用于识别数据源 | |
jdbcUrl | 数据库地址 | |
username | 数据库登录名 | |
password | 数据库登录密码 | |
driverClassName | 可以根据Url自动进行识别 | |
initialSize | 0 | 初始化的时候建立的物理连接个数 |
maxActive | 8 | 最大连接池数 |
maxIdle | 8 | 失效,不配 |
minIdle | 失效,不配 | |
maxWait | 获取连接的最大等待时间,会启动公平锁(配置useUnfairLock为true使用非公平锁) | |
poolPreparedStatements | false | 是否缓存PSCache游标,Mysql5.5以下不支持 |
maxOpenPreparedStatements | -1 | 配置PSCache最大值,如果配置该项,poolPreparedStatements强制为true |
validationQuery | 配置是否检测查询类sql的有效性 | |
testOnBorrow | true | 检测sql有效性,会降低性能 |
testOnReturn | false | 返回检测结果,会降低性能 |
testWhileIdle | false | 是否检测空闲连接超时,由timeBetweenEvictionRunsMillis控制超时时间 |
timeBetweenEvictionRunsMillis | 空闲连接超时设置 | |
numTestsPerEvictionRun | 无效,不配 | |
minEvictableIdleTimeMillis | ||
connectionInitSqls | 物理连接被初始化的时候执行的sql | |
exceptionSorter | 根据dbType自动识别 | 当数据库抛出不可恢复异常时,断开该连接 |
filters | 配置扩展插件,stat(监控),log4j(日志),wall(sql注入防御) | |
proxyFilters | 代理,他不会替代filters,而是会并存 |
2.使用配置项的方法
在ApplicationContext.xml 中如何配置这些项目?
<!-- druid 数据库连接池配置示例 -->
< bean id = "dataSource" class = "com.alibaba.druid.pool.DruidDataSource"destroy-method = "close" >
<!-- 通过 property 的name指定配置项,value指定配置项的值 -->
< property name = "url" value = "${url}" />
< property name = "username" value = "${username}" />
< property name = "password" value = "${password}" />
< property name = "driverClassName" value = "${driverClassName}" />
< property name = "filters" value = "${filters}" />
</ bean >
推荐内容




阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
最近提交(Master分支:8 个月前 )
1aea5ae6
* fix subquery and tableExpr inside 'from' of 'update statement'
* add dbtype adb_mysql
* preserve owner of allColumnExpr in cloneto 1 个月前
b043fd17
1 个月前
更多推荐
相关推荐
查看更多
druid

Druid是一个高速的数据查询引擎,主要用于OLAP场景。它的特点是快速查询、支持复杂查询语句、易于部署等。适用于数据分析和报告生成场景。
druid

Apache Druid: a high performance real-time analytics database.
druid

阿里云计算平台DataWorks(https://help.aliyun.com/document_detail/137663.html) 团队出品,为监控而生的数据库连接池
热门开源项目
活动日历
查看更多
直播时间 2025-04-09 14:34:18

樱花限定季|G-Star校园行&华中师范大学专场
直播时间 2025-04-07 14:51:20

樱花限定季|G-Star校园行&华中农业大学专场
直播时间 2025-03-26 14:30:09

开源工业物联实战!
直播时间 2025-03-25 14:30:17

Heygem.ai数字人超4000颗星火燎原!
直播时间 2025-03-13 18:32:35

全栈自研企业级AI平台:Java核心技术×私有化部署实战
目录
所有评论(0)