Skip site navigation (1) Skip section navigation (2)

Re: Multiple logical databases

From: Chris Campbell <chris(at)bignerdranch(dot)com>
To: Mark Woodward <pgsql(at)mohawksoft(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Multiple logical databases
Date: 2006-02-03 13:47:05
Message-ID: 41E24F06-4015-49B4-82ED-3BB0DF2DFBC9@bignerdranch.com (view raw or flat)
Thread:
Lists: pgsql-hackerspgsql-patches
On Feb 3, 2006, at 08:05, Mark Woodward wrote:

> Using the "/etc/hosts" file or DNS to maintain host locations for is a
> fairly common and well known practice, but there is no such  
> mechanism for
> "ports." The problem now becomes a code issue, not a system  
> administration
> issue.

What if you assigned multiple IPs to a machine, then used ipfw (or  
something) to forward connections to port 5432 for each IP to the  
proper IP and port?

You could use /etc/hosts or DNS to give each IP a host name, and use  
it in your code.

For example (this only does forwarding for clients on localhost, but  
you get the idea), you could set up:

Host      IP:port          Forwards to
--------  ---------------  -----------------
db_one    127.0.1.1:5432   192.168.1.5:5432
db_two    127.0.1.2:5432   192.168.1.6:5432
db_three  127.0.1.3:5432   192.168.1.6:5433
fb_four   127.0.1.4:5432   16.51.209.8:8865

You could reconfigure the redirection by changing the ipfw  
configuration -- you wouldn't change your client code at all. It  
would continue to use a connection string of "... host=db_one", but  
you'd change 127.0.1.1:5432 to forward to the new IP/port.

Or use pgpool. :)

- Chris


In response to

Responses

pgsql-hackers by date

Next:From: Martijn van OosterhoutDate: 2006-02-03 13:50:56
Subject: Re: Passing arguments to views
Previous:From: Martijn van OosterhoutDate: 2006-02-03 13:34:25
Subject: Re: Multiple logical databases

pgsql-patches by date

Next:From: Bruce MomjianDate: 2006-02-03 13:51:06
Subject: Re: [HACKERS] Some platform-specific MemSet research
Previous:From: Martijn van OosterhoutDate: 2006-02-03 13:34:25
Subject: Re: Multiple logical databases

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group