question regarding connection failover URL postgresql 9.6 (master/slave)

From: martin zoldano <martinzoldano(at)gmail(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: question regarding connection failover URL postgresql 9.6 (master/slave)
Date: 2016-10-21 23:27:47
Message-ID: CACmatnZURfQ1C+u7YmRFzw29yy0j6mVAFHSabf7Vy56kh3ENPg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 <http://www.linkedin.com/in/martinzoldano>

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Dave Cramer 2016-10-23 11:39:58 Re: [RFC] How about changing the default value of defaultRowFetchSize?
Previous Message Vitalii Tymchyshyn 2016-10-21 12:12:50 Re: [RFC] How about changing the default value of defaultRowFetchSize?