pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
/var/run/postgresql/.s.PGSQL.5432 should be 5433
9+ messages / 6 participants
[nested] [flat]

* /var/run/postgresql/.s.PGSQL.5432 should be 5433
@ 2016-09-27 08:08  Poul Kristensen <bcc5226@gmail.com>
  0 siblings, 4 replies; 9+ messages in thread

From: Poul Kristensen @ 2016-09-27 08:08 UTC (permalink / raw)
  To: pgsql-admin

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

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433
@ 2016-09-27 13:09  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Poul Kristensen <bcc5226@gmail.com>
  3 siblings, 0 replies; 9+ messages in thread

From: Tom Lane @ 2016-09-27 13:09 UTC (permalink / raw)
  To: Poul Kristensen <bcc5226@gmail.com>; +Cc: pgsql-admin

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


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433
@ 2016-09-27 13:21  Scott Whitney <scott@journyx.com>
  parent: Poul Kristensen <bcc5226@gmail.com>
  3 siblings, 1 reply; 9+ messages in thread

From: Scott Whitney @ 2016-09-27 13:21 UTC (permalink / raw)
  To: Poul Kristensen <bcc5226@gmail.com>; pgsql-admin

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/

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433
@ 2016-09-27 14:51  Alvaro Herrera <alvherre@2ndquadrant.com>
  parent: Scott Whitney <scott@journyx.com>
  0 siblings, 1 reply; 9+ messages in thread

From: Alvaro Herrera @ 2016-09-27 14:51 UTC (permalink / raw)
  To: Scott Whitney <scott@journyx.com>; +Cc: Poul Kristensen <bcc5226@gmail.com>; pgsql-admin

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


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433
@ 2016-09-27 15:16  Scott Mead <scottm@openscg.com>
  parent: Poul Kristensen <bcc5226@gmail.com>
  3 siblings, 0 replies; 9+ messages in thread

From: Scott Mead @ 2016-09-27 15:16 UTC (permalink / raw)
  To: Poul Kristensen <bcc5226@gmail.com>; +Cc: pgsql-admin

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 <http://openscg.com>*
http://openscg.com

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433
@ 2016-09-27 16:08  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Alvaro Herrera <alvherre@2ndquadrant.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Tom Lane @ 2016-09-27 16:08 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@2ndquadrant.com>; +Cc: Scott Whitney <scott@journyx.com>; Poul Kristensen <bcc5226@gmail.com>; pgsql-admin

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


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433
@ 2016-09-28 10:27  Devrim Gündüz <devrim@gunduz.org>
  parent: Poul Kristensen <bcc5226@gmail.com>
  3 siblings, 1 reply; 9+ messages in thread

From: Devrim Gündüz @ 2016-09-28 10:27 UTC (permalink / raw)
  To: Poul Kristensen <bcc5226@gmail.com>; pgsql-admin


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

Attachments:

  signature.asc (application/pgp-signature, 818B) download

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433
@ 2016-09-28 11:32  Poul Kristensen <bcc5226@gmail.com>
  parent: Devrim Gündüz <devrim@gunduz.org>
  0 siblings, 1 reply; 9+ messages in thread

From: Poul Kristensen @ 2016-09-28 11:32 UTC (permalink / raw)
  To: Devrim Gündüz <devrim@gunduz.org>; pgsql-admin

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

^ permalink  raw  reply  [nested|flat] 9+ messages in thread

* Re: /var/run/postgresql/.s.PGSQL.5432 should be 5433
@ 2016-09-29 18:47  Poul Kristensen <bcc5226@gmail.com>
  parent: Poul Kristensen <bcc5226@gmail.com>
  0 siblings, 0 replies; 9+ messages in thread

From: Poul Kristensen @ 2016-09-29 18:47 UTC (permalink / raw)
  To: pgsql-admin

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! :)

^ permalink  raw  reply  [nested|flat] 9+ messages in thread


end of thread, other threads:[~2016-09-29 18:47 UTC | newest]

Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-09-27 08:08 /var/run/postgresql/.s.PGSQL.5432 should be 5433 Poul Kristensen <bcc5226@gmail.com>
2016-09-27 13:09 ` Tom Lane <tgl@sss.pgh.pa.us>
2016-09-27 13:21 ` Scott Whitney <scott@journyx.com>
2016-09-27 14:51   ` Alvaro Herrera <alvherre@2ndquadrant.com>
2016-09-27 16:08     ` Tom Lane <tgl@sss.pgh.pa.us>
2016-09-27 15:16 ` Scott Mead <scottm@openscg.com>
2016-09-28 10:27 ` Devrim Gündüz <devrim@gunduz.org>
2016-09-28 11:32   ` Poul Kristensen <bcc5226@gmail.com>
2016-09-29 18:47     ` Poul Kristensen <bcc5226@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox