question regarding connection failover URL postgresql 9.6 (master/slave) - Mailing list pgsql-jdbc

From martin zoldano
Subject question regarding connection failover URL postgresql 9.6 (master/slave)
Date
Msg-id CACmatnZURfQ1C+u7YmRFzw29yy0j6mVAFHSabf7Vy56kh3ENPg@mail.gmail.com
Whole thread Raw
Responses Re: question regarding connection failover URL postgresql 9.6 (master/slave)  (Vitalii Tymchyshyn <vit@tym.im>)
Re: question regarding connection failover URL postgresql 9.6 (master/slave)  (Vitalii Tymchyshyn <vit@tym.im>)
List pgsql-jdbc
Hello

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 and 2nd:

url="jdbc:postgresql://MASTER:5432,SLAVE:5432/XXDB?targetServerType=preferSlave"

when stopping SLAVE service connections failover MASTER as expected, but it seems to be a one way failover, if I restart SLAVE service it never fails back to SLAVE (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.
 
Your helps is extremely appreciated!! thanks in advance.......

Sincerely,
Martin

pgsql-jdbc by date:

Previous
From: martin zoldano
Date:
Subject: question regarding connection failover URL postgresql 9.6 (master/slave)
Next
From: Dave Cramer
Date:
Subject: Re: [RFC] How about changing the default value of defaultRowFetchSize?