Mysql连接在grails应用程序中超时,在ELB上使用mariadb galera集群

thi*_*ass 5 grails datasource mariadb amazon-elb galera

我刚刚迁移了我的数据库以支持使用从mysql到mariadb的2节点集群数据库进行复制.数据库托管在不同的域上并通过ELB访问,当我将应用程序指向节点之一时,应用程序正常工作但当我使用ELB URL连接数据库时,它随机波动并经常显示followint错误

Communication Link Failure
could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query
Run Code Online (Sandbox Code Playgroud)

这是我的数据源配置: -

dataSource {
shard = false
pooled = true
driverClassName = "com.mysql.jdbc.Driver"
dbCreate = "update" // one of 'create', 'create-drop','update'

properties {
    initialSize=5
    maxActive=50
    minIdle=5
    maxIdle=25
    maxWait = 10000
    maxAge = 10 * 60000
    timeBetweenEvictionRunsMillis=5000
    minEvictableIdleTimeMillis=60000
    validationQuery="SELECT 1"
    validationInterval=15000
    testWhileIdle=true
    testOnBorrow=true
    testOnReturn=false
    jdbcInterceptors = "ConnectionState"
    defaultTransactionIsolation = java.sql.Connection.TRANSACTION_READ_COMMITTED
}
Run Code Online (Sandbox Code Playgroud)

任何人都可以确定错误是什么,并提供一个可能的解决方案

thi*_*ass 4

我发现了这个问题,ELB中有一个名为idleTimeOut的字段,它设置为仅60秒,并且花费超过1分钟的查询意外下降,在将超时增加到600秒后,问题不再重复。:)