From: | Benoit Salotti <benoit(dot)salotti(at)gmail(dot)com> |
---|---|
To: | John R Pierce <pierce(at)hogranch(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: How to send queries to master and failover to slave ? |
Date: | 2016-06-28 14:01:06 |
Message-ID: | CAH9tKGkW2MUa5iKm1FeCnD-1iymSqM2TH_s2sixEm8w4fR+pAA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
I totally agree with you but this is not immediate. We use repmgr to handle
the failures and the DBAs have setup 6 retries with 10 seconds delay
between each retry.
So during 1 minute I'm not able to serve read queries even if my slave is
available, the preferMaster option would allow me to do it very easily.
2016-06-28 12:37 GMT+02:00 John R Pierce <pierce(at)hogranch(dot)com>:
> On 6/28/2016 2:41 AM, Benoit Salotti wrote:
>
>>
>> I have a setup with 1 master and 1 slave (hot standy to serve read
>> queries if necessary).
>> I would like the JDBC driver to talk preferrably to the master (to be
>> sure to get the freshest data). If the master is not available I would like
>> to send the queries to the slave.
>>
>> The documentation mentions the following values for the parameter
>> targetServerType: any, master, slave, preferSlave.
>> I'm surprised there is no preferMaster option which would allow me to
>> implement easily my requirement.
>>
>>
>
> normally, if the master is not available, that means its failed, and your
> HA cluster management will promote the slave to be the new master, fencing
> off the old master until it can be manually reset and restored as the new
> slave.
>
>
>
> --
> john r pierce, recycling bits in santa cruz
>
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | VANOLE, MICHAEL J | 2016-07-06 15:39:49 | Using Pg JDBC driver with perl DBD::JDBC |
Previous Message | Benoit Salotti | 2016-06-28 13:48:35 | Re: How to send queries to master and failover to slave ? |