BUG #6689: socket file name convention doesn't allow different IPs and the same port for different pgclusters
The following bug has been logged on the website:
Bug reference: 6689
Logged by: Mark
Email address: ms@it-infrastrukturen.org
PostgreSQL version: 9.1.3
Operating system: unbuntu-server 12.04 LTS
Description:
When using /var/run/postgresql/ as unix_socket_directory for "main" and
"second" pgcluster and different IP-interfaces (addresse) for every
pgcluster (but the same default port number), there are different pid file
names (like 9.1-main.pid and 9.1-secondpg.pid) *but* names of unix_sockek
files doesn't follow such name conventions.
It results in error when trying to run the second pgcluster with another IP
but the same (default port 5432):
Error: Port conflict: another instance is already running on on
/var/run/postgresql with port 5432
regards, Mark
On Wed, Jun 13, 2012 at 2:45 AM, <ms@it-infrastrukturen.org> wrote:
The following bug has been logged on the website:
Bug reference: 6689
Logged by: Mark
Email address: ms@it-infrastrukturen.org
PostgreSQL version: 9.1.3
Operating system: unbuntu-server 12.04 LTS
Description:When using /var/run/postgresql/ as unix_socket_directory for "main" and
"second" pgcluster and different IP-interfaces (addresse) for every
pgcluster (but the same default port number), there are different pid file
names (like 9.1-main.pid and 9.1-secondpg.pid) *but* names of unix_sockek
files doesn't follow such name conventions.It results in error when trying to run the second pgcluster with another IP
but the same (default port 5432):
Error: Port conflict: another instance is already running on on
/var/run/postgresql with port 5432
First of all, this is not a bug - this is intended behaviour. Perhaps
the documentation needs to be clearified on the fact that the port
number needs to be unique across all instances though.
One reason is that the port number is used to control several other
things. Just the Unix socket is only one of the things - it also
controls the name of shared memory segments, so it still won't work if
you work around that.
All instances need to have their own ports. If you want to listen on
the same port on different IPs, you will need to use something like
kernel level ip forwarding to rewrite the access, and actually run
PostgreSQL on different ports still.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/
Hello Magnus,
Thanks a lot for your time checking my email.
Am 15.06.2012 07:56, schrieb Magnus Hagander:
On Wed, Jun 13, 2012 at 2:45 AM,<ms@it-infrastrukturen.org> wrote:
The following bug has been logged on the website:
Bug reference: 6689
Logged by: Mark
Email address: ms@it-infrastrukturen.org
PostgreSQL version: 9.1.3
Operating system: unbuntu-server 12.04 LTS
Description:When using /var/run/postgresql/ as unix_socket_directory for "main" and
"second" pgcluster and different IP-interfaces (addresse) for every
pgcluster (but the same default port number), there are different pid file
names (like 9.1-main.pid and 9.1-secondpg.pid) *but* names of unix_sockek
files doesn't follow such name conventions.It results in error when trying to run the second pgcluster with another IP
but the same (default port 5432):
Error: Port conflict: another instance is already running on on
/var/run/postgresql with port 5432First of all, this is not a bug - this is intended behaviour. Perhaps
the documentation needs to be clearified on the fact that the port
number needs to be unique across all instances though.
Even it is not an implementation bug it is a kind of *conception* bug
from my point of view.
There is *no* real reason why port numbers should be different for
different IP addresses.
There is anything about running further psql instances on different
ethernet interfaces (on one box) in the current doc yet.
One reason is that the port number is used to control several other
things. Just the Unix socket is only one of the things - it also
controls the name of shared memory segments, so it still won't work if
you work around that.
When I want to run two separate psql instances they should use also
separate shared memory segments.
All instances need to have their own ports. If you want to listen on
the same port on different IPs, you will need to use something like
kernel level ip forwarding to rewrite the access, and actually run
PostgreSQL on different ports still.
Using different port number for the second ethernet interface works as
expected.
How complex is it to implement different unix_socket names in the sourse
code?
(when further instances listen on different ethernet interfaces)
regards, Mark
--
ms@it-infrastrukturen.org
On Fri, Jun 15, 2012 at 7:33 PM, Mark Schneider
<ms@it-infrastrukturen.org> wrote:
Am 15.06.2012 07:56, schrieb Magnus Hagander:
On Wed, Jun 13, 2012 at 2:45 AM,<ms@it-infrastrukturen.org> wrote:
The following bug has been logged on the website:
Bug reference: 6689
Logged by: Mark
Email address: ms@it-infrastrukturen.org
PostgreSQL version: 9.1.3
Operating system: unbuntu-server 12.04 LTS
Description:When using /var/run/postgresql/ as unix_socket_directory for "main" and
"second" pgcluster and different IP-interfaces (addresse) for every
pgcluster (but the same default port number), there are different pid
file
names (like 9.1-main.pid and 9.1-secondpg.pid) *but* names of unix_sockek
files doesn't follow such name conventions.It results in error when trying to run the second pgcluster with another
IP
but the same (default port 5432):
Error: Port conflict: another instance is already running on on
/var/run/postgresql with port 5432First of all, this is not a bug - this is intended behaviour. Perhaps
the documentation needs to be clearified on the fact that the port
number needs to be unique across all instances though.Even it is not an implementation bug it is a kind of *conception* bug from
my point of view.
That's why I'm suggesting updating the documentation to make that more clear.
There is *no* real reason why port numbers should be different for different
IP addresses.
True. But as I said, it doesn't just control the TCP port *or* the
unix socket name.
There is anything about running further psql instances on different ethernet
interfaces (on one box) in the current doc yet.
Right. That's my suggested fix.
One reason is that the port number is used to control several other
things. Just the Unix socket is only one of the things - it also
controls the name of shared memory segments, so it still won't work if
you work around that.When I want to run two separate psql instances they should use also separate
shared memory segments.
Exaclty. Which is why they need separate port numbers. If they use the
same port number, they'd use the same shared memory segment...
All instances need to have their own ports. If you want to listen on
the same port on different IPs, you will need to use something like
kernel level ip forwarding to rewrite the access, and actually run
PostgreSQL on different ports still.Using different port number for the second ethernet interface works as
expected.
Yes. For just the ethernet interface. But again, the parameter
controls more things.
How complex is it to implement different unix_socket names in the sourse
code?
(when further instances listen on different ethernet interfaces)
Probably not hugely so, but it wouldn't fix your problem.
There's an ongoing discussoin on-hackers about being able to listen to
multiple unix sockets, and multiple port numbers. But as you'll see if
you read up on that one (see archives.postgresql.org), it's all still
requiring a single "primary port" to control the other parts. So that
also won't solve your problem.
--
Magnus Hagander
Me: http://www.hagander.net/
Work: http://www.redpill-linpro.com/