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

From: Vitalii Tymchyshyn <vit(at)tym(dot)im>
To: martin zoldano <martinzoldano(at)gmail(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: question regarding connection failover URL postgresql 9.6 (master/slave)
Date: 2016-10-23 13:50:03
Message-ID: CABWW-d1YdLZVafUiOoCuK1tUVA1zOSaK9-NTmo0ryxSP_KGBQQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)gmail(dot)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 <http://www.linkedin.com/in/martinzoldano>
>

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Jorge Solórzano 2016-10-23 22:03:48 Re: [RFC] How about changing the default value of defaultRowFetchSize?
Previous Message Dave Cramer 2016-10-23 11:39:58 Re: [RFC] How about changing the default value of defaultRowFetchSize?