Re: pg_ctlcluster is not stopping cluster

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Telium Technical Support <support(at)telium(dot)io>, pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: pg_ctlcluster is not stopping cluster
Date: 2023-04-07 23:01:01
Message-ID: eb2f69fe-6d0a-2cc4-6bd5-2700bf859031@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 for it's status it says the server is running.
>
> What does this mean?
>
> root(at)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(at)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(at)d11:/var/tmp/myapp#
>

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Jerry Sievers 2023-04-08 04:27:55 Re: pg_ctlcluster is not stopping cluster
Previous Message Telium Technical Support 2023-04-07 23:00:52 RE: pg_ctlcluster is not stopping cluster