From: Adrian Klaver <adrian.klaver@aklaver.com>
To: Telium Technical Support <support@telium.io>
To: pgsql-general@lists.postgresql.org
Subject: Re: pg_ctlcluster is not stopping cluster
Date: Fri, 7 Apr 2023 16:01:01 -0700
Message-ID: <eb2f69fe-6d0a-2cc4-6bd5-2700bf859031@aklaver.com> (raw)
In-Reply-To: <010001875deafb29-7de12ba6-1d4a-4770-baa2-234e971e6b99-000000@email.amazonses.com>
References: <010001875dd4ebe6-ba96b71f-2461-45da-ab24-0abf56f56f4f-000000@email.amazonses.com>
<5beba911-281c-685f-509a-73d7af990897@aklaver.com>
<010001875deafb29-7de12ba6-1d4a-4770-baa2-234e971e6b99-000000@email.amazonses.com>
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@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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: adrian.klaver@aklaver.com, support@telium.io
Subject: Re: pg_ctlcluster is not stopping cluster
In-Reply-To: <eb2f69fe-6d0a-2cc4-6bd5-2700bf859031@aklaver.com>
References: <010001875dd4ebe6-ba96b71f-2461-45da-ab24-0abf56f56f4f-000000@email.amazonses.com> <5beba911-281c-685f-509a-73d7af990897@aklaver.com> <010001875deafb29-7de12ba6-1d4a-4770-baa2-234e971e6b99-000000@email.amazonses.com> <eb2f69fe-6d0a-2cc4-6bd5-2700bf859031@aklaver.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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