I just recently migrated my database to support replication with a 2 node cluster database from mysql to mariadb. The database are hosted over different domain and is accessed over a ELB, when I point my application to one of the node the application works fine but when I use the ELB url to connect with the database, it randomly fluctuates and frequently show the followint error
Communication Link Failure
could not execute query; nested exception is org.hibernate.exception.JDBCConnectionException: could not execute query
Here is my datasource configuration:-
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
}
Can anyone please identify whats wrong and provide a possible solution for it
I figured out the issue, there was a field in ELB called idleTimeOut which was set to only 60 sec, and query which took more than 1 min was droping unexpectedly, after increasing the timeout to 600 sec the problem is not replicating anymore. :)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With