druidデータベース接続プール-接続タイムアウトの問題

995 ワード

druid構成に接続タイムアウト回収メカニズムを追加する.
jdbc-url: jdbc:mysql://172.119.0.12:3306/jzj_dev?useUnicode=true&characterEncodeing=utf-8
      username: root
      password: x5
      driverClassName: com.mysql.jdbc.Driver
  #            ,           
  #      ,  ,  
      initialSize: 1
      minIdle: 1
      maxActive: 20
      maxWait: 60000
      timeBetweenEvictionRunsMillis: 60000
      minEvictableIdleTimeMillis: 300000
      validationQuery: SELECT 1
      testWhileIdle: true
      testOnReturn: false
      testOnBorrow: false
      poolPreparedStatements: true
      maxPoolPreparedStatementPerConnectionSize: 20
      #         filters,       sql     ,'wall'     
      filters: stat, wall, log4j
      connectionProperties: druid.stat.mergeSql=true;druid.stat.slowSqlMillis=5000
      #      
      removeAbandoned: true
      removeAbandonedTimeout: 1800
      logAbandoned: false

logAbandoned=「true」がtrueに設定され、プログラムは接続を回収しながらログを印刷します.速度に影響し、本番運転はオフにできます.