Re: Failover Datasource?

From: Bruce Adams <bruce(dot)adams(at)acm(dot)org>
To: pgsql-jdbc(at)postgresql(dot)org
Cc: Tim H <drgonzo1337(at)gmail(dot)com>
Subject: Re: Failover Datasource?
Date: 2011-06-16 19:33:26
Message-ID: 4DFA5A86.9030301@acm.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

I, too, would like to be able to specify multiple Postgres servers in a
JDBC connection URL. I want the client application to prefer connecting
to a master database, but automatically failover to a replica when the
master is unavailable.

Many other databases have this feature in their JDBC drivers. For
example a MySQL JDBC URL can have a comma separated list of host:port in
the URL, like this:
jdbc:mysql://master:3306,slave:3306/databasename

Is there some other way to setup client failover?

Writings I've found for Postgres always talk about a proxy, or even
multiple proxies (!), between the Java client and the real database
servers. I'm trying to build a robust system; any additional layer is
yet another thing that can break. I don't mind having the application
see errors in a failover, I just want some measure of recovery to be
automatic, even if the automatic recovery is to a read-only replica.

I plan to use streaming replication in PostgreSQL 9.0 for the hot backup(s).

- Bruce

On Tue, 15 Apr 2008 10:12:07 -0400, Tim H wrote:
> I'd like to create a pooling JDBC datasource that can handle failing
> over to an alternate URL.
>
> I've seen drivers from other vendors that allow you to pass in two
> databases in the connection URL. I've scoured the mailing list here
> and haven't found a thing.
>
> Can someone point me in the right direction?
>
> Thanks,
> Tim
>
> --
> ./tch

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Thomas Kellerer 2011-06-16 19:56:33 Re: Failover Datasource?
Previous Message Israel Ben Guilherme Fonseca 2011-06-14 11:22:50 Re: Question about speed: Weird Behavior