Skip to content
Permalink
Browse files

fix formatting of section on failover, still not perfect but better (#…

  • Loading branch information
davecramer committed Jun 27, 2017
1 parent 73bc3c1 commit 9f72201458d1ce0837e9525d947dcea2828b9475
Showing with 16 additions and 16 deletions.
  1. +16 −16 docs/documentation/head/connect.md
@@ -417,26 +417,26 @@ Connection conn = DriverManager.getConnection(url);
for logical replication from that database. <p>Parameter should be use together with
`assumeMinServerVersion` with parameter >= 9.4 (backend >= 9.4)

<a name="connection-failover"></a>
## Connection Fail-over
<a name="connection-failover"></a>
## Connection Fail-over

To support simple connection fail-over it is possible to define multiple endpoints
(host and port pairs) in the connection url separated by commas.
The driver will try to once connect to each of them in order until the connection succeeds.
If none succeed, a normal connection exception is thrown.
To support simple connection fail-over it is possible to define multiple endpoints
(host and port pairs) in the connection url separated by commas.
The driver will try to once connect to each of them in order until the connection succeeds.
If none succeed, a normal connection exception is thrown.

The syntax for the connection url is:
The syntax for the connection url is:

`jdbc:postgresql://host1:port1,host2:port2/database`
`jdbc:postgresql://host1:port1,host2:port2/database`

The simple connection fail-over is useful when running against a high availability
postgres installation that has identical data on each node.
For example streaming replication postgres or postgres-xc cluster.
The simple connection fail-over is useful when running against a high availability
postgres installation that has identical data on each node.
For example streaming replication postgres or postgres-xc cluster.

For example an application can create two connection pools.
One data source is for writes, another for reads. The write pool limits connections only to master node:
For example an application can create two connection pools.
One data source is for writes, another for reads. The write pool limits connections only to master node:

`jdbc:postgresql://node1,node2,node3/accounting?targetServerType=master`.
And read pool balances connections between slaves nodes, but allows connections also to master if no slaves are available:
`jdbc:postgresql://node1,node2,node3/accounting?targetServerType=master`.
And read pool balances connections between slaves nodes, but allows connections also to master if no slaves are available:

`jdbc:postgresql://node1,node2,node3/accounting?targetServerType=preferSlave&loadBalanceHosts=true`
`jdbc:postgresql://node1,node2,node3/accounting?targetServerType=preferSlave&loadBalanceHosts=true`

0 comments on commit 9f72201

Please sign in to comment.
You can’t perform that action at this time.