How to configure non-xa datasource failover in EAP 6/7?

Solution Verified - Updated -

Issue

  • We need to set up datasource failover in EAP 6 so that when one database is unavailable it will automatically transfer load to an alternate database.
  • We are looking for a way to implement datasource failover at the datasource level.
  • How to perform a task like, If primary datasource is not responding (or shut down forcefully, due to high CPU, errors, etc.), it will automatically fail-over to secondary datasource?
  • Fail-over is not working on JBoss EAP 6 datasources. In standalone-*.xml file the datasource configuration looks as below:
   <datasource jndi-name="java:/sampleDS" pool-name="sampleDS" enabled="true" > 
       <connection-url>jdbc:postgresql:@host:port/postgres|jdbc:postgresql:@host:port/postgres</connection-url>
       <url-delimiter>|</url-delimiter>
       <driver>postgres</driver>
       <security>
          <user-name>sample</user-name>
          <password>sample</password>
       </security>
   </datasource>
  • How to configure HA Data Source in JBoss EAP 6 ? Does JBoss need a restart when a database instance goes down?

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 6
    • 7
  • url-delimiter and url-selector-strategy-class-name as defined in
    • jboss-as-datasources_1_0.xsd
    • jboss-as-datasources_1_1.xsd
    • wildfly-datasources_<version>.xsd for EAP 7

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content