On JBoss7 , I heard we can use a vertical bar "|" to separate the two databases url and when the one was shuted down , The other can be good start , So our web application can run normally !
Accordind to JBoss7' configuration , I configured the WildFly8 as following:
- <datasource jndi-name="java:jboss/mysql/mysql01" pool-name="back-mysql" enabled="true" use-java-context="true">
- <connection-url>jdbc:mysql://ONEIP:3306/datasource1|jbc:mysql://TWOIP:3306/datasource2/connection-url>
- <driver>com.mysql</driver>
- <transaction-isolation>TRANSACTION_READ_COMMITTED</transaction-isolation>
- <url-delimiter>|</url-delimiter>
- <pool>
- <min-pool-size>10</min-pool-size>
- <max-pool-size>100</max-pool-size>
- <prefill>false</prefill>
- </pool>
- <security>
- <user-name>root</user-name>
- </security>
- <validation>
- <check-valid-connection-sql>select * from Courese</check-valid-connection-sql>
- <validate-on-match>true</validate-on-match>
- <background-validation>true</background-validation>
- </validation>
- <timeout>
- <idle-timeout-minutes>1</idle-timeout-minutes>
- </timeout>
- </datasource>
At first , access my page didn't occur error , But when i stop one mysql datasource , Sometimes normal visit, sometimes not .
How can i achieve two datasources configuration in WildFly8 , Can anyone tell me , Thanks !
--liuzhihong