pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: John R Pierce <pierce@hogranch.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: How to send queries to master and failover to slave ?
Date: Tue, 28 Jun 2016 03:37:51 -0700
Message-ID: <4ae74d8b-2a0e-68fc-93ce-ccbf2abd1744@hogranch.com> (raw)
In-Reply-To: <CAH9tKGn1QpazJjt6jxGfXO-tDMTYbrBUzxz4cZaESZt==6x_BQ@mail.gmail.com>
References: <CAH9tKGn1QpazJjt6jxGfXO-tDMTYbrBUzxz4cZaESZt==6x_BQ@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

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



-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc



view thread (8+ messages)  latest in thread

Message-ID: <4ae74d8b-2a0e-68fc-93ce-ccbf2abd1744@hogranch.com>
Permalink:  ../4ae74d8b-2a0e-68fc-93ce-ccbf2abd1744@hogranch.com/
Also on:    postgresql.org/message-id/4ae74d8b-2a0e-68fc-93ce-ccbf2abd1744@hogranch.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: pierce@hogranch.com
  Subject: Re: How to send queries to master and failover to slave ?
  In-Reply-To: <4ae74d8b-2a0e-68fc-93ce-ccbf2abd1744@hogranch.com>
  References: <CAH9tKGn1QpazJjt6jxGfXO-tDMTYbrBUzxz4cZaESZt==6x_BQ@mail.gmail.com> <4ae74d8b-2a0e-68fc-93ce-ccbf2abd1744@hogranch.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox