Problem starting PG-9.2 on non-default port

Started by James B. Byrneover 13 years ago10 messagesgeneral
Jump to latest
#1James B. Byrne
byrnejb@harte-lyne.ca

I wish to run an instance of PG-9.2 concurrently with our production
version (9.1). I have changed the listening port number.

listen_addresses = 'pgsql-dbms.hamilton.harte-lyne.ca, localhost'
#port = 5432 # (change requires restart)
port = 5433

However, I am getting this error when I try to start the new version
while the old one is still running. Is there something else I must do
to accomplish this? Why is the lock file using the default port
number for this instance?

cat ../pgstartup.log
2012-12-14 09:13:41 EST : LOG: XX000: could not bind IPv4 socket:
Address already in use
2012-12-14 09:13:41 EST : HINT: Is another postmaster already
running on port 5432? If not, wait a few seconds and retry.
2012-12-14 09:13:41 EST : LOCATION: StreamServerPort, pqcomm.c:438
2012-12-14 09:13:41 EST : WARNING: 01000: could not create listen
socket for "pgsql-dbms.hamilton.harte-lyne.ca"
2012-12-14 09:13:41 EST : LOCATION: PostmasterMain, postmaster.c:892
2012-12-14 09:13:41 EST : FATAL: F0001: lock file
"/tmp/.s.PGSQL.5432.lock" already exists
2012-12-14 09:13:41 EST : HINT: Is another postmaster (PID 1299)
using socket file "/tmp/.s.PGSQL.5432"?
2012-12-14 09:13:41 EST : LOCATION: CreateLockFile, miscinit.c:822

--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3

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

#2Devrim GÜNDÜZ
devrim@gunduz.org
In reply to: James B. Byrne (#1)
Re: Problem starting PG-9.2 on non-default port

Hi,

Is this an RPM installation? If so, you also need to change the port in the init script, too.

Regards, Devrim

"James B. Byrne" <byrnejb@harte-lyne.ca> wrote:

I wish to run an instance of PG-9.2 concurrently with our production
version (9.1). I have changed the listening port number.

listen_addresses = 'pgsql-dbms.hamilton.harte-lyne.ca, localhost'
#port = 5432 # (change requires restart)
port = 5433

However, I am getting this error when I try to start the new version
while the old one is still running. Is there something else I must do
to accomplish this? Why is the lock file using the default port
number for this instance?

cat ../pgstartup.log
2012-12-14 09:13:41 EST : LOG: XX000: could not bind IPv4 socket:
Address already in use
2012-12-14 09:13:41 EST : HINT: Is another postmaster already
running on port 5432? If not, wait a few seconds and retry.
2012-12-14 09:13:41 EST : LOCATION: StreamServerPort, pqcomm.c:438
2012-12-14 09:13:41 EST : WARNING: 01000: could not create listen
socket for "pgsql-dbms.hamilton.harte-lyne.ca"
2012-12-14 09:13:41 EST : LOCATION: PostmasterMain,
postmaster.c:892
2012-12-14 09:13:41 EST : FATAL: F0001: lock file
"/tmp/.s.PGSQL.5432.lock" already exists
2012-12-14 09:13:41 EST : HINT: Is another postmaster (PID 1299)
using socket file "/tmp/.s.PGSQL.5432"?
2012-12-14 09:13:41 EST : LOCATION: CreateLockFile, miscinit.c:822

--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3

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

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

#3Adrian Klaver
adrian.klaver@aklaver.com
In reply to: James B. Byrne (#1)
Re: Problem starting PG-9.2 on non-default port

On 12/14/2012 06:26 AM, James B. Byrne wrote:

I wish to run an instance of PG-9.2 concurrently with our production
version (9.1). I have changed the listening port number.

listen_addresses = 'pgsql-dbms.hamilton.harte-lyne.ca, localhost'
#port = 5432 # (change requires restart)
port = 5433

However, I am getting this error when I try to start the new version
while the old one is still running. Is there something else I must do
to accomplish this? Why is the lock file using the default port
number for this instance?

Are you sure you are starting the correct server instance?

--
Adrian Klaver
adrian.klaver@gmail.com

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

#4James B. Byrne
byrnejb@harte-lyne.ca
In reply to: Adrian Klaver (#3)
Re: Problem starting PG-9.2 on non-default port

On Fri, December 14, 2012 09:40, Adrian Klaver wrote:

On 12/14/2012 06:26 AM, James B. Byrne wrote:

I wish to run an instance of PG-9.2 concurrently with our production
version (9.1). I have changed the listening port number.

listen_addresses = 'pgsql-dbms.hamilton.harte-lyne.ca, localhost'
#port = 5432 # (change requires restart)
port = 5433

However, I am getting this error when I try to start the new version
while the old one is still running. Is there something else I must
do
to accomplish this? Why is the lock file using the default port
number for this instance?

Are you sure you are starting the correct server instance?

Well, this is what I am doing:

service postgresql-9.2 start
Starting postgresql-9.2 service: [FAILED]

And this is the log file with the error:

cat /var/lib/pgsql/9.2/pgstartup.log

2012-12-14 09:43:38 EST : LOG: XX000: could not bind IPv4 socket:
Address already in use
2012-12-14 09:43:38 EST : HINT: Is another postmaster already
running on port 5432? If not, wait a few seconds and retry.
2012-12-14 09:43:38 EST : LOCATION: StreamServerPort, pqcomm.c:438
2012-12-14 09:43:38 EST : WARNING: 01000: could not create listen
socket for "pgsql-dbms.hamilton.harte-lyne.ca"
2012-12-14 09:43:38 EST : LOCATION: PostmasterMain, postmaster.c:892
2012-12-14 09:43:38 EST : FATAL: F0001: lock file
"/tmp/.s.PGSQL.5432.lock" already exists
2012-12-14 09:43:38 EST : HINT: Is another postmaster (PID 1299)
using socket file "/tmp/.s.PGSQL.5432"?
2012-12-14 09:43:38 EST : LOCATION: CreateLockFile, miscinit.c:822

And this is the running instance:

service postgresql-9.1 status
postgresql-9.1 (pid 1299) is running...

So, I am fairly sure that I am trying to get 9.2 started and failing
and not trying to start another instance of 9.1.

--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3

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

#5Birta Levente
blevi.linux@gmail.com
In reply to: Devrim GÜNDÜZ (#2)
Re: Problem starting PG-9.2 on non-default port

On 14/12/2012 16:37, Devrim G�nd�z wrote:

Hi,

Is this an RPM installation? If so, you also need to change the port in
the init script, too.

Or if it's rhel/centos/sciencific like linux, you can specify in
/etc/sysconfig/pgsql/postgresql-9.2:
PGPORT=5433

Regards, Devrim

"James B. Byrne" <byrnejb@harte-lyne.ca> wrote:

I wish to run an instance of PG-9.2 concurrently with our production
version (9.1). I have changed the listening port number.

listen_addresses = 'pgsql-dbms.hamilton.harte-lyne.ca <http://pgsql-dbms.hamilton.harte-lyne.ca&gt;, localhost'
#port = 5432 # (change requires restart)
port = 5433

However, I am getting this error when I try to start the new version
while the old one is still running. Is there something else I must do
to accomplish this? Why is the lock file using the default port
number for this instance?

cat ../pgstartup.log
2012-12-14 09:13:41 EST : LOG: XX000: could not bind IPv4 socket:
Address already in use
2012-12-14 09:13:41 EST : HINT: Is another postmaster already
running on port 5432? If not, wait a few seconds and retry.
2012-12-14 09:13:41 EST :
LOCATION: StreamServerPort, pqcomm.c:438
2012-12-14 09:13:41 EST : WARNING: 01000: could not create listen
socket for "pgsql-dbms.hamilton.harte-lyne.ca <http://pgsql-dbms.hamilton.harte-lyne.ca&gt;&quot;
2012-12-14 09:13:41 EST : LOCATION: PostmasterMain, postmaster.c:892
2012-12-14 09:13:41 EST : FATAL: F0001: lock file
"/tmp/.s.PGSQL.5432.lock" already exists
2012-12-14 09:13:41 EST : HINT: Is another postmaster (PID 1299)
using socket file "/tmp/.s.PGSQL.5432"?
2012-12-14 09:13:41 EST : LOCATION: CreateLockFile, miscinit.c:822

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

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

#6Adrian Klaver
adrian.klaver@aklaver.com
In reply to: James B. Byrne (#4)
Re: Problem starting PG-9.2 on non-default port

On 12/14/2012 06:48 AM, James B. Byrne wrote:

And this is the running instance:

service postgresql-9.1 status
postgresql-9.1 (pid 1299) is running...

So, I am fairly sure that I am trying to get 9.2 started and failing
and not trying to start another instance of 9.1.

Assuming an RPM install, see Devrims reply.

--
Adrian Klaver
adrian.klaver@gmail.com

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

#7James B. Byrne
byrnejb@harte-lyne.ca
In reply to: Adrian Klaver (#6)
Re: Problem starting PG-9.2 on non-default port

On Fri, December 14, 2012 09:52, Adrian Klaver wrote:

Assuming an RPM install, see Devrims reply.

Might one inquire as to why it is necessary to override the
configuration file in the startup script?

--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3

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

#8Tom Lane
tgl@sss.pgh.pa.us
In reply to: James B. Byrne (#7)
Re: Problem starting PG-9.2 on non-default port

"James B. Byrne" <byrnejb@harte-lyne.ca> writes:

On Fri, December 14, 2012 09:52, Adrian Klaver wrote:

Assuming an RPM install, see Devrims reply.

Might one inquire as to why it is necessary to override the
configuration file in the startup script?

There's some background about that here:
https://bugzilla.redhat.com/show_bug.cgi?id=803295

Recent Fedora RPMs have added the attached patch, which Devrim might
care to borrow if he hasn't already.

regards, tom lane

#9James B. Byrne
byrnejb@harte-lyne.ca
In reply to: James B. Byrne (#7)
Re: Problem starting PG-9.2 on non-default port

On Fri, December 14, 2012 10:21, James B. Byrne wrote:

On Fri, December 14, 2012 09:52, Adrian Klaver wrote:

Assuming an RPM install, see Devrims reply.

Might one inquire as to why it is necessary to override the
configuration file in the startup script?

This is a patch for /etc/init.d/postgresql-9.2 to retrieve the port
from the postgresql.conf file and override the default setting if it
is set there. The last two calls to 'cut' handle both tabs and spaces
as whitespace.

76a77,88

# Override port setting from postgresql.conf if set
PGCONFPORT=$(grep -e "^port" $PGDATA/postgresql.conf | \
cut -d "=" -f 2 | \
sed -e 's/^[ \t]*//' | \
cut -f1 | \
cut -d " " -f 1)
if [[ -n "$PGCONFPORT" ]] # -n == defined and not blank
then
echo "Setting PGPORT to $PGCONFPORT from $PGDATA/postgresql.conf"
PGPORT=$PGCONFPORT
fi

--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3

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

#10James B. Byrne
byrnejb@harte-lyne.ca
In reply to: James B. Byrne (#7)
Re: Problem starting PG-9.2 on non-default port

On Fri, December 14, 2012 10:21, James B. Byrne wrote:

This is a patch for /etc/init.d/postgresql-9.2 to retrieve the port
from the postgresql.conf file and override the default setting if it

A slight, but important, correction that handles leading white space
in the first selection:

76a77,88

# Override port setting from postgresql.conf if set
PGCONFPORT=$(grep -e "^\s*port" $PGDATA/postgresql.conf | \
cut -d "=" -f 2 | \
sed -e 's/^[ \t]*//' | \
cut -f1 | \
cut -d " " -f 1)
if [[ -n "$PGCONFPORT" ]] # -n == defined and non-blank -z == not

defined

then
echo "Setting PGPORT to $PGCONFPORT from $PGDATA/postgresql.conf"
PGPORT=$PGCONFPORT
fi

--
*** E-Mail is NOT a SECURE channel ***
James B. Byrne mailto:ByrneJB@Harte-Lyne.ca
Harte & Lyne Limited http://www.harte-lyne.ca
9 Brockley Drive vox: +1 905 561 1241
Hamilton, Ontario fax: +1 905 561 0757
Canada L8E 3C3

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