Обсуждение: /var/run/postgresql/.s.PGSQL.5432 should be 5433

Поиск
Список
Период
Сортировка

/var/run/postgresql/.s.PGSQL.5432 should be 5433

От
Poul Kristensen
Дата:
Hi !

I have need to have to difference Postgres version runnung on the same RHEL 7.2 server.

They are listening on 2 different ports as configured but socket is still listening
on  port 5432 for  both of them.

How come and how do I change this?

TIA

Poul 

Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433

От
Tom Lane
Дата:
Poul Kristensen <bcc5226@gmail.com> writes:
> I have need to have to difference Postgres version runnung on the same RHEL
> 7.2 server.

> They are listening on 2 different ports as configured but socket is
> still listening on port 5432 for both of them.

It sounds like you didn't configure the second one correctly, but since
you said nothing about what you did to configure it, it's hard to offer
any concrete advice.

            regards, tom lane


Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433

От
Scott Whitney
Дата:

1) You should have a script in /etc/init.d called something like postgresql-VERSION


2) Rename this to postgresql-SomeIdentifierThatRunsOn5432

3) Copy it to postgresql-SomeIdentifiedThatRunsOn5433

4) You now have 2 identical scripts in /etc/init.d


5) In /etc/sysconfig/pgsql create 2 scripts named the same thing. The exact same names as your scripts in /etc/init.d


6) They will say something like this:


PGDATA=/pgdata/myDirTo5432
PGPORT=5432
PGLOG=/var/lib/pgsql/pgstartup.${PGPORT}.log


PGDATA=/pgdata/myDirTo5433
PGPORT=5433
PGLOG=/var/lib/pgsql/pgstartup.${PGPORT}.log


Then do your service SCRIPTNAME initdb and service SCRIPTNAME start


Works for me.






From: pgsql-admin-owner@postgresql.org <pgsql-admin-owner@postgresql.org> on behalf of Poul Kristensen <bcc5226@gmail.com>
Sent: Tuesday, September 27, 2016 3:08 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] /var/run/postgresql/.s.PGSQL.5432 should be 5433
 
Hi !

I have need to have to difference Postgres version runnung on the same RHEL 7.2 server.

They are listening on 2 different ports as configured but socket is still listening
on  port 5432 for  both of them.

How come and how do I change this?

TIA

Poul 



Journyx, Inc.
7600 Burnet Road #300
Austin, TX 78757
www.journyx.com

p 512.834.8888 
f 512-834-8858 

Do you receive our promotional emails? You can subscribe or unsubscribe to those emails at http://go.journyx.com/emailPreference/e/4932/714/ 

Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433

От
Alvaro Herrera
Дата:
Scott Whitney wrote:
> 1) You should have a script in /etc/init.d called something like postgresql-VERSION
>
>
> 2) Rename this to postgresql-SomeIdentifierThatRunsOn5432
>
> 3) Copy it to postgresql-SomeIdentifiedThatRunsOn5433

I think it's better to keep one of these under the original name, and
make the second one a symlink to it.  That way, the whole system won't
break when the packages are updated.  Other than that little detail,
your suggested procedure seems sound ... in a pre-systemd world.  I am
not familiar with systemd enough to know what, if anything, should be
done differently there (I don't know whether RHEL 7.2 is systemd or
not).

--
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services


Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433

От
Scott Mead
Дата:


On Tue, Sep 27, 2016 at 4:08 AM, Poul Kristensen <bcc5226@gmail.com> wrote:
Hi !

I have need to have to difference Postgres version runnung on the same RHEL 7.2 server.

They are listening on 2 different ports as configured but socket is still listening
on  port 5432 for  both of them.

1. What version of postgres?
2. Where did you get your binaries from ? PGDG, etc...

In your postgresql.conf for each instance, what do you have for:

listen_addresses=?
port=?
unix_socket_directories=?


Most likely, the second instance you created has the socket in /tmp/, whereas the one created by the RPMs has the socket in /tmp AND /var/run/postgresql

--Scott

 

How come and how do I change this?

TIA

Poul 




--
--
Scott Mead
Sr. Architect
OpenSCG

Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433

От
Tom Lane
Дата:
Alvaro Herrera <alvherre@2ndquadrant.com> writes:
> your suggested procedure seems sound ... in a pre-systemd world.  I am
> not familiar with systemd enough to know what, if anything, should be
> done differently there (I don't know whether RHEL 7.2 is systemd or
> not).

RHEL7 is systemd.  It's been several years since I touched those packages,
but I have some vague recollection that the systemd unit files for PG
insist on setting the port for themselves, overriding whatever you might
put into postgresql.conf.  So you'd need to make a second unit file and
adjust the port setting in it.

            regards, tom lane


Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433

От
Devrim Gündüz
Дата:
Hi,

On Tue, 2016-09-27 at 10:08 +0200, Poul Kristensen wrote:
> I have need to have to difference Postgres version runnung on the same RHEL
> 7.2 server.
>
> They are listening on 2 different ports as configured but socket is still
> listening
> on  port 5432 for  both of them.
>
> How come and how do I change this?

If you installed Postgres from Red Hat repos (likely), then change the port
number in unit file for the second instance. The recommended way is copying the
unit file under /etc/systemd/system/ and modify from there.

If you installed from PGDG repos, then changing port from postgresql.conf is
sufficient.

Regards,
--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR

Вложения

Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433

От
Poul Kristensen
Дата:
Thanks a lot everybody!

I think the solution is

ystemd

Some configuration parameters are passed to daemon via command line options. This behaviour may override settings in postgresql.conf. For example, if you want to change the server's port number to 5433, create a file named "/etc/systemd/system/postgresql.service" containing:

.include /lib/systemd/system/postgresql.service
[Service] 
Environment=PGPORT=5433-- 

I have not tested yet. 

2016-09-28 12:27 GMT+02:00 Devrim Gündüz <devrim@gunduz.org>:

Hi,

On Tue, 2016-09-27 at 10:08 +0200, Poul Kristensen wrote:
> I have need to have to difference Postgres version runnung on the same RHEL
> 7.2 server.
>
> They are listening on 2 different ports as configured but socket is still
> listening
> on  port 5432 for  both of them.
>
> How come and how do I change this?

If you installed Postgres from Red Hat repos (likely), then change the port
number in unit file for the second instance. The recommended way is copying the
unit file under /etc/systemd/system/ and modify from there.

If you installed from PGDG repos, then changing port from postgresql.conf is
sufficient.

Regards,
--
Devrim GÜNDÜZ
EnterpriseDB: http://www.enterprisedb.com
PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer
Twitter: @DevrimGunduz , @DevrimGunduzTR



--
Med venlig hilsen / Best regards
Poul Kristensen
Linux-OS/Virtualizationexpert and Oracle DBA

Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433

От
Poul Kristensen
Дата:
The simple solution for me!

psql -h /tmp -p 5433 

where /tmp is the Unix_socket_directories in postgresql.conf in the second version of postgres on tne same rhel 7.2 server.

works! :)