Re: Proposal: Implement failover on libpq connect level.

From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
To: Victor Wagner <vitus(at)wagner(dot)pp(dot)ru>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: Implement failover on libpq connect level.
Date: 2015-08-20 03:06:31
Message-ID: CAA4eK1LvugdRvXbEw_o7OSddVBRH8LD7s8qrwO3Z3gUfcpuG0Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-jdbc

On Wed, Aug 19, 2015 at 1:23 PM, Victor Wagner <vitus(at)wagner(dot)pp(dot)ru> wrote:
>
> On 2015.08.19 at 12:55:15 +0530, Amit Kapila wrote:
>
> > > I think that failover procedure should begin before first connection
is
> > > ever established.
> > >
> >
> > As far as I understand, failover gets initiated once the master server
goes
> > down or is not accessible due to some reason, so for such cases if you
> > have the connection to both the servers then it might not work.
>
> Master server might go down when client is not started yet.
> And when client starts up, it has to find out which server to connect
> now.
>

Always try with the first server specified in connection string and if that
is not available try with second and so on. I think for the case of
failover,
the design shouldn't be much complicated and it is a standard thing provided
by most of the client-side drivers in other databases. Considering what
currently PostgreSQL offers in terms of high-availability functionality, for
load-balancing, we need to be careful of many more things like redirecting
read-queries to standby's, write statements should be executed via
connection
to master.

With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2015-08-20 03:19:27 Re: DBT-3 with SF=20 got failed
Previous Message Tomas Vondra 2015-08-20 02:25:36 Re: PATCH: use foreign keys to improve join estimates v1

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mikko Tiihonen 2015-08-20 07:16:45 Re: best way to convert JSONB object from result
Previous Message Dave Cramer 2015-08-20 02:13:42 Re: best way to convert JSONB object from result