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

From Vitalii Tymchyshyn
Subject Re: question regarding connection failover URL postgresql 9.6 (master/slave)
Date
Msg-id CABWW-d1YdLZVafUiOoCuK1tUVA1zOSaK9-NTmo0ryxSP_KGBQQ@mail.gmail.com
Whole thread Raw
In response to question regarding connection failover URL postgresql 9.6 (master/slave)  (martin zoldano <martinzoldano@gmail.com>)
List pgsql-jdbc
As far as I understand any failover can happen only when new connection is requested by the pool from the driver. Thus you should configure the pool for maximum connection life span. Otherwise good connections will never be reconnected back.

Best regards, Vitalii Tymchyshyn

Сб, 22 жовт. 2016 20:11 користувач martin zoldano <martinzoldano@gmail.com> пише:
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: Dave Cramer
Date:
Subject: Re: [RFC] How about changing the default value of defaultRowFetchSize?
Next
From: Dave Cramer
Date:
Subject: Re: [RFC] How about changing the default value of defaultRowFetchSize?