Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A58FFB5DBC0 for ; Thu, 16 Jun 2011 17:27:19 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 33571-04 for ; Thu, 16 Jun 2011 20:27:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vx0-f174.google.com (mail-vx0-f174.google.com [209.85.220.174]) by mail.postgresql.org (Postfix) with ESMTP id 271E1B5D803 for ; Thu, 16 Jun 2011 17:27:13 -0300 (ADT) Received: by vxi39 with SMTP id 39so1481831vxi.19 for ; Thu, 16 Jun 2011 13:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:message-id:date:from:user-agent :mime-version:to:subject:references:in-reply-to:content-type :content-transfer-encoding; bh=+HVVybHKpWdkJjdFF9hrr+VPmUFKSpvbvFNffOrKGJs=; b=RaE0YTB1LZbKfxkvXhGdk6McMtichF9NCzWUT3theeT/i2VvQJ0URXmfaAF7HbeCmG w8oCt/4m9QGljLg+Iwjxz/kRH5MXag/wjD0ijBBbq37O0y4u+1FSHSaV1XNIZL9E0D54 n1Qs7u9Fb0w4pVNQsMWV11rXjaBsq9bJl8UbU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; b=Z/Tc54m66XF2lEWufXjovNlcW7eK3dF1yXWM8qur39gZkTONQMQCVdmBtI6Sir8MqH jEA0YNqWkp8yj0CBz7E2OWE3x9w3QhfKPHVoZyn6QILFUhdxi8S1iAM9AFdNO287I9QG XmWc7ZzKor/lh5RoIsV20i19JtA7L1W/woK64= Received: by 10.52.75.137 with SMTP id c9mr1839101vdw.310.1308256032873; Thu, 16 Jun 2011 13:27:12 -0700 (PDT) Received: from [192.168.0.221] (office.vivisimo.com [206.210.75.84]) by mx.google.com with ESMTPS id l15sm668023vdt.22.2011.06.16.13.27.12 (version=SSLv3 cipher=OTHER); Thu, 16 Jun 2011 13:27:12 -0700 (PDT) Message-ID: <4DFA671F.2050005@acm.org> Date: Thu, 16 Jun 2011 16:27:11 -0400 From: Bruce Adams User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110516 Thunderbird/3.1.10 MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Failover Datasource? References: <4DFA5A86.9030301@acm.org> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.888 tagged_above=-10 required=5 tests=BAYES_00=-1.9, FREEMAIL_FROM=0.001, RFC_ABUSE_POST=0.001, T_TO_NO_BRKTS_FREEMAIL=0.01 X-Spam-Level: X-Archive-Number: 201106/40 X-Sequence-Number: 21964 Both pgBouncer and pgPool add another process between the client and the server. Their primary goal appears to be connection pooling. My Java application server (Apache Tomcat) is already pooling database connections. Adding another chunk of middle-ware adds another thing I have to worry about failing and is likely to slow things down. If I write code to add failover support into the JDBC driver, what are my chances of getting that patch into the next release? - Bruce On 06/16/2011 03:56 PM, Thomas Kellerer wrote: > 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