Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id D5A4DB5D801 for ; Thu, 16 Jun 2011 16:56:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 08064-05 for ; Thu, 16 Jun 2011 19:56:53 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from lo.gmane.org (lo.gmane.org [80.91.229.12]) by mail.postgresql.org (Postfix) with ESMTP id 55B66B5D8BD for ; Thu, 16 Jun 2011 16:56:52 -0300 (ADT) Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QXIgJ-0000SS-EG for pgsql-jdbc@postgresql.org; Thu, 16 Jun 2011 21:56:47 +0200 Received: from ppp-188-174-12-30.dynamic.mnet-online.de ([188.174.12.30]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jun 2011 21:56:47 +0200 Received: from spam_eater by ppp-188-174-12-30.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 16 Jun 2011 21:56:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-jdbc@postgresql.org From: Thomas Kellerer Subject: Re: Failover Datasource? Date: Thu, 16 Jun 2011 21:56:33 +0200 Lines: 31 Message-ID: References: <4DFA5A86.9030301@acm.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: ppp-188-174-12-30.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: <4DFA5A86.9030301@acm.org> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.899 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, T_RP_MATCHES_RCVD=-0.01, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201106/39 X-Sequence-Number: 21963 Bruce Adams wrote on 16.06.2011 21:33: > 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). pgBouncer or pgPool can both do that as far as I know http://wiki.postgresql.org/wiki/PgBouncer http://pgpool.projects.postgresql.org/ Thomas