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
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-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

Browse pgsql-hackers by date

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

Browse pgsql-patches by date

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