Re: pg_ctlcluster is not stopping cluster - Mailing list pgsql-general

From Adrian Klaver
Subject Re: pg_ctlcluster is not stopping cluster
Date
Msg-id eb2f69fe-6d0a-2cc4-6bd5-2700bf859031@aklaver.com
Whole thread Raw
In response to RE: pg_ctlcluster is not stopping cluster  ("Telium Technical Support" <support@telium.io>)
List pgsql-general
On 4/7/23 15:51, Telium Technical Support wrote:
> I tried the command you suggested, and it shows that data directory status as "DOWN".  Yet when I ask pg_ctlcluster
forit's status it says the server is running.
 
> 
> What does this mean?
> 
> root@d11:/var/tmp/myapp# pg_lsclusters
> Ver Cluster Port Status Owner    Data directory              Log file
> 13  main    5432 down   postgres /var/lib/postgresql/13/main /var/log/postgresql/postgresql-13-main.log
> 15  main    5433 down   postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log

Neither cluster is running.

To confirm do:

ps ax | grep postgres

> root@d11:/var/tmp/myapp# sudo -u postgres /usr/bin/pg_ctlcluster 15 main status -- -D /var/lib/postgresql/13/main
> pg_ctl: server is running (PID: 2701882)

Best guess, is that because of this:

sudo -u postgres /usr/bin/pg_ctlcluster 15 main stop -- -m fast -D 
/var/lib/postgresql/13/main

the Postgres pid did not get removed on shutdown.

Bottom line you should not use

pg_ctlcluster 15 main stop

to

shut down a 13 cluster located at:

-D /var/lib/postgresql/13/main

Just do:

sudo -u postgres /usr/bin/pg_ctlcluster 15 main stop -m fast

or

sudo -u postgres /usr/bin/pg_ctlcluster 13 main stop -- -m fast

depending on which cluster you want to shut down.


> /usr/lib/postgresql/15/bin/postgres "-D" "/var/lib/postgresql/13/main" "-c"
"config_file=/etc/postgresql/15/main/postgresql.conf"
> root@d11:/var/tmp/myapp#
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: "Telium Technical Support"
Date:
Subject: RE: pg_ctlcluster is not stopping cluster
Next
From: Jerry Sievers
Date:
Subject: Re: pg_ctlcluster is not stopping cluster