Re: DB alias ?

From: Steve Crawford <scrawford(at)pinpointresearch(dot)com>
To: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
Cc: Rob Sargent <robjsargent(at)gmail(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: DB alias ?
Date: 2013-01-23 22:25:46
Message-ID: 5100636A.7050505@pinpointresearch.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 01/23/2013 02:08 PM, Gauthier, Dave wrote:
> For each phase of a project, a new DB is created.... But in the meantime, I have to redirect them to P2_DB without changing anything in the linux environment. I need to have the DB itself "know" that the dbname "P3_DB" really = "P2_DB" for the time being. A simple mapping capability could do it.
>
> I'm googling around for the connection service stuff, but its really sparse. And its not clear where, in my linux install, I'm supposed to find the config file. Even if I find it, I'll need a utility that the DBA can use to modify it (I won't have direct access to it for manual edit or anything like that). But a service file concept sounds intriguing.
>
>

First, the convention on this mailing list is to bottom-post so people
can follow threads. Top-posting is frowned upon.

Given your expanded description I think you should look at pgBouncer.
Although it is intended as a connection pooler, the configuration allows
you to set a database name on the client-facing side that is different
than the actual name of the database the pooler connects to. So both
p2_db and p3_db could point to real_p2_db until you update the pgBouncer
config.

Depending on how you authenticate/authorize you may have to fuss with
some of the password settings and to minimize client-side changes you
will probably have to change PostgreSQL to listen on a different port
then have pgBouncer listen on the standard 5432 so things appear
unchanged to the clients.

As a bonus, the new databases can be on different machines if you choose.

http://pgfoundry.org/projects/pgbouncer/

Cheers,
Steve

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Devrim GÜNDÜZ 2013-01-23 22:39:03 Replacement for Oracle Workspace Manager
Previous Message Andrew Sullivan 2013-01-23 22:17:59 Re: DB alias ?