Thread: Feature suggestion: Postgresql binding to one IP?

Feature suggestion: Postgresql binding to one IP?

From
Lincoln Yeoh
Date:
Hi people,

Is it possible for Postgresql to bind to one IP address? 

I'm trying to run multiple postgresql installations on one server.

The unix socket could be named accordingly:

Postgresql config bound to a particular port and all IPs.
.s.PGSQL.<portnumber> 

Postgresql config bound to a particular port and IP.
.s.PGSQL.<portnumber>.<ipaddress>

Any other suggestions/comments on running multiple instances of postgresql
are welcomed.

An less desirable alternative is to keep binding to all IP, use different
ports and name the ports, but specifying the port by name in -p doesn't work. 

Cheerio,
Link.



Re: Feature suggestion: Postgresql binding to one IP?

From
Tom Lane
Date:
Lincoln Yeoh <lyeoh@pop.jaring.my> writes:
> Is it possible for Postgresql to bind to one IP address? 

See 'virtual_host' GUC parameter.
        regards, tom lane


Re: Feature suggestion: Postgresql binding to one

From
Lincoln Yeoh
Date:
At 11:16 PM 03-10-2001 -0400, Tom Lane wrote:
>Lincoln Yeoh <lyeoh@pop.jaring.my> writes:
>> Is it possible for Postgresql to bind to one IP address? 
>
>See 'virtual_host' GUC parameter.
>
>            regards, tom lane

Thanks!

I'm using a redhat style postgresql init and somehow postgresql seems to
ignore the postgresql.conf file. What's the postmaster.opts file for?

Cheerio,
Link.



Re: Feature suggestion: Postgresql binding to one

From
Tom Lane
Date:
Lincoln Yeoh <lyeoh@pop.jaring.my> writes:
> I'm using a redhat style postgresql init and somehow postgresql seems to
> ignore the postgresql.conf file.

That seems unlikely, assuming you are running a PG version recent enough
to have a postgresql.conf file (ie 7.1 or better).  What exactly are you
putting into postgresql.conf?  Also, take a look at the postmaster log
to see if it's issuing any complaints.  I believe a syntax error
anywhere in the conf file will cause the whole file to be ignored ...

> What's the postmaster.opts file for?

It's to log the command-line options you gave to the postmaster.
        regards, tom lane


Re: Feature suggestion: Postgresql binding to one IP?

From
"Mark Pritchard"
Date:
Hi Lincoln,

Not sure why you would want to run multiple instances, since you can run
multiple dbs if you want to maintain separate environments but if you really
need to do this, the postmaster has some options which control ip/port
binds:

[pritchma@blade pritchma]$ /usr/local/pgsql/bin/postmaster --help
/usr/local/pgsql/bin/postmaster is the PostgreSQL server.

Usage: /usr/local/pgsql/bin/postmaster [options...]

Options: -B NBUFFERS     number of shared buffers (default 64) -c NAME=VALUE   set run-time parameter -d 1-5
debugginglevel -D DATADIR      database directory -F              turn fsync off -h HOSTNAME     host name or IP
addressto listen on -i              enable TCP/IP connections -k DIRECTORY    Unix-domain socket location -N
MAX-CONNECT maximum number of allowed connections (1..1024, default
 
32) -o OPTIONS      pass 'OPTIONS' to each backend server -p PORT         port number to listen on (default 5432) -S
         silent mode (start in background without logging output)
 

Developer options: -n              do not reinitialize shared memory after abnormal exit -s              send SIGSTOP
toall backend servers if one dies
 

I run postgres on a box with two interfaces, and I only want it to bind to a
single one:

# start postgres
nohup > /dev/null su -c '/usr/local/pgsql/bin/postmaster -h 10.4.0.1 -i -D
/usr/local/pgsql/data > /usr/local/pgsql/log/server.log 2>&1' postgres &


Cheers,

Mark Pritchard