Home > database >  Consult a 8 hours of problems when using mysql replication
Consult a 8 hours of problems when using mysql replication

Time:09-21

Background:

The persistence layer separation because of the need to read and write, project is to use the spring data jpa, because most development work completed, considering the impact on code invasion degree, decided by the way MySQL ReplicationDriver

Driver: com. Mysql. JDBC. ReplicationDriver
Database connection pool: org. Apache. Tomcat. JDBC. Pool. The DataSource

Problem:
Connect Mysql default have eight hours of effective time, more than eight hours of free connection failure, normally, we configure
Tomcat:
The test -- while idle: true
Time - between - eviction - runs - millis: 1800000
Validation - query: SELECT 1
Wait for means to solve, but the younger brother after using ReplicationDriver now, have a problem in this way
Because ReplicationDriver provides connection, the internal contains a master connection and a slave connection,
Don't know the connection and connection pool of concrete internal implementation, so lead to the connection pool to perform the verification statement SELECT 1, forever will only verify the master connection, so lead to slave connection connection idle for a long time, and then submitted to the eight hours of associated anomalies

Consult everybody, how to settle the
  • Related