Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > pgsql.interfaces.jdbc > #2

Connection failover URL postgresql 9.6 (master/slave) jdbc driver [9.4-1211]

Newsgroups pgsql.interfaces.jdbc
Date 2016-10-24 11:13 -0700
Message-ID <d2cb553a-c083-440e-9d92-b0c12f7825a0@googlegroups.com> (permalink)
Subject Connection failover URL postgresql 9.6 (master/slave) jdbc driver [9.4-1211]
From martinzoldano@gmail.com

Show all headers | View raw


question regarding connection failover URL postgresql 9.6 (master/slave), when a node( SLAVE per se) does down connections failover MASTER as expected but ONE WAY ONLY!!, if we restart SLQVE service connections never recover back.

stack: postgresql 9.6 (master/slave) + jdbc driver 9.4-1211 + tomcat7 + jdk7 + built-in ConnectionPool

ref:  https://jdbc.postgresql.org/documentation/head/connect.html      (bottom section)

Issue:  upon having MASTER + SLAVE services running , we segregate via two DataSources to point to 1st: MASTER only and 2nd:
url="jdbc:postgresql://MASTER:5432,SLAVE:5432/XXDB?targetServerType=preferSlave"

when stopping SLAVE service connections failover to MASTER as expected, but it seems to be a one way failover, if I restart SLAVE service it never fails back to it (unless we restart Tomcat service)

I played around with other parameters hostRecheckSeconds and loadBalanceHosts as well as changing order url="SLAVE,MASTER?targetServerType=preferSlave" as well but same thing.
 
Note: app runs primarily on DS1 with master read/write, and we run BI-DW-reports / read-only on slave DS2, we don't expect the feature of bringing down master node to fail over to slave, that is not the case here but viceversa instead.

Your helps is extremely appreciated!! thanks in advance.......
Sincerely,
Martin 

Back to pgsql.interfaces.jdbc | Previous | Next | Find similar


Thread

Connection failover URL postgresql 9.6 (master/slave) jdbc driver [9.4-1211] martinzoldano@gmail.com - 2016-10-24 11:13 -0700

csiph-web