Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 48C00B5D803 for ; Thu, 16 Jun 2011 16:33:38 -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 92066-06 for ; Thu, 16 Jun 2011 19:33:32 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-vw0-f46.google.com (mail-vw0-f46.google.com [209.85.212.46]) by mail.postgresql.org (Postfix) with ESMTP id 03C1EB5D801 for ; Thu, 16 Jun 2011 16:33:31 -0300 (ADT) Received: by vws1 with SMTP id 1so1420118vws.19 for ; Thu, 16 Jun 2011 12:33:31 -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:cc:subject:content-type:content-transfer-encoding; bh=8YzgKaq05QG/qCvV0BPk7hOwr+TJXLPvSODS0yaTWnQ=; b=EAAGAf+285bnE/MtCBgAI3YG7F9udgFYqhLAYO2LlFqE3PVR2sRT2xozVEoBzSaARo Q4scO2fjbzNEFnDFS+J+iifMoG+GF2CT0dKY8ZrOFZ05PAFsXksiD76ecAymPS5G9wHJ 2JKr0MCwwQ387P24E3oAzCGSd931ld9zSm9tE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :content-type:content-transfer-encoding; b=SzV+oPW+1VnnGifKFSbtZfjfWX968pUg7cUY80rsQkTFDQyzEzqdv11HMXqArmiSWI tWHLHCU9Og6zI01i4r/fhq+mARhMpgtp39Soy7XkTk2TGy8z3jnSu/RG+cSCozI5eJWa dbpDBnTLa9C9KpGERh0tzzYb86vk0p0Qe1sno= Received: by 10.52.96.195 with SMTP id du3mr1738594vdb.276.1308252811657; Thu, 16 Jun 2011 12:33:31 -0700 (PDT) Received: from [192.168.0.221] (office.vivisimo.com [206.210.75.84]) by mx.google.com with ESMTPS id du6sm649226vdb.45.2011.06.16.12.33.27 (version=SSLv3 cipher=OTHER); Thu, 16 Jun 2011 12:33:29 -0700 (PDT) Message-ID: <4DFA5A86.9030301@acm.org> Date: Thu, 16 Jun 2011 15:33:26 -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 CC: Tim H Subject: Re: Failover Datasource? 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/38 X-Sequence-Number: 21962 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