jdbc:teiid:<vdb-name>@mm://host1:31000,host1:31001,host2:31000;version=2
Using Multiple Hosts
A group of Teiid Servers in the same WildFly cluster may be connected using failover and load-balancing features.
External HA / Load Balancers
You may choose to use an external tcp load balancer, such as haproxy. The Teiid driver/DataSource should then typically be configured to just use the single host/port of your load balancer.
Even if you configure the load balancer to redirect when there is a failed host, that will not maintain the Teiid session state. If you wish to keep the connection alive, then use the autoFailover feature discussed below. Otherwise the other Teiid Client Features are not necessary when using an external load balancer.
Teiid Client Features
To enable theses features in their simplest form, the client needs to specify multiple host name and port number combinations on the URL connection string.
If you are using a DataSource to connect to Teiid Server, use the "AlternateServers" property/method to define the failover servers. The format is also a comma separated list of host:port combinations.
The client will randomly pick one the Teiid server from the list and establish a session with that server. If that server cannot be contacted, then a connection will be attempted to each of the remaining servers in random order. This allows for both connection time fail-over and random server selection load balancing.
Fail Over
Post connection fail over will be used if the autoFailover connection property on JDBC URL is set to true. Post connection failover works by sending a ping, at most every second, to test the connection prior to use. If the ping fails, a new instance will be selected prior to the operation being attempted.
This is not true "transparent application failover" as the client will not restart the transaction/query/recreate session scoped temp tables, etc. So this feature should be used with caution.