-
Enhancement
-
Resolution: Done
-
Major
-
Upstream
-
CLOUD Maintenance Sprint 6
Today our EAP images are not prepared to reconnect automatically with the database if it goes does for some reason. If it happens the pod should be restarted. This configuration allows the EAP to auto-reconnect in the database without a restart.
Options:
1- Connection validation: There is two types:
-> For every new connection: <validate-on-match>true</validate-on-match> (preferred, but it can overload the database, because for every new connection it is tested first).
-> <background-validation>true</background-validation>
Check the connection for every X milis: <background-validation>true</background-validation> and <background-validation-millis>X millis</background-validation-millis>
2- Validation mechanisms
-> <valid-connection-checker class-name="a.b.c" /> ( in this case, for mysql we should use this value: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker) / (Preferred method)
-> <check-valid-connection-sql>select 1</check-valid-connection-sql>
3- Exception sorter:
-> <exception-sorter class-name="x.y.z" /> For mysql: org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter
Example of configurations:
<datasource jndi-name="java:jboss//datasources/MySqlDS" pool-name="MySqlDS"> <connection-url>jdbc:mysql://mysql-localhost:3306/jbossdb</connection-url> <driver>mysql</driver> <security> <user-name>admin</user-name> <password>admin</password> </security> <validation> <validate-on-match>true</validate-on-match> <background-validation>false</background-validation> <valid-connection-checker class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLValidConnectionChecker"></valid-connection-checker> <exception-sorter class-name="org.jboss.jca.adapters.jdbc.extensions.mysql.MySQLExceptionSorter"></exception-sorter> </validation> </datasource>
For postgreSQL the valid-connection-checker and exception-sorter class-name values are, respectively:
org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLValidConnectionChecker
org.jboss.jca.adapters.jdbc.extensions.postgres.PostgreSQLExceptionSorter
- clones
-
CLOUD-498 Configure the datasources on EAP to be fault tolerant
- Closed