Re: issue performing a switchover with repmgr

From: Dylan Luong <Dylan(dot)Luong(at)unisa(dot)edu(dot)au>
To: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: issue performing a switchover with repmgr
Date: 2017-05-23 00:14:12
Message-ID: 6f2371c0d39945518ca478b8cd9a47ad@ITUPW-EXMBOX2B.UniNet.unisa.edu.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Thanks for you answer. So is there a way to remove this -w from the repmgr switchover process?

-----Original Message-----
From: Adrian Klaver [mailto:adrian(dot)klaver(at)aklaver(dot)com]
Sent: Monday, 22 May 2017 10:27 PM
To: Dylan Luong <Dylan(dot)Luong(at)unisa(dot)edu(dot)au>; pgsql-general(at)postgresql(dot)org
Subject: Re: [GENERAL] issue performing a switchover with repmgr

On 05/22/2017 01:15 AM, Dylan Luong wrote:
> Hi
>
> I have setup a master/standby on PostgreSQL95 on two test servers and
> trialing out repmgr. (https://github.com/2ndQuadrant/repmgr/)
>
> I am testing a switchover using the following:
>
> -bash-4.1$ repmgr -f /etc/repmgr/9.5/repmgr.conf -C
> /etc/repmgr/9.5/repmgr.conf standby switchover -L DEBUG -v
>
> The switchover appears to hang at the last part of the switchover process....
>
> /NOTICE: restarting server using '/usr/pgsql-9.5/bin/pg_ctl -w -D
> /var/lib/pgsql/9.5/data -m fast restart'/
>
> /pg_ctl: PID file "/var/lib/pgsql/9.5/data/postmaster.pid" does not
> exist/
>
> /Is server running?/
>
> /starting server anyway/
>
> It appears to have worked though as when I run the cluster show
> command on both servers it showing the switchover.
>
> /-bash-4.1$ repmgr -f /etc/repmgr/9.5/repmgr.conf cluster show/
>
> /Role | Name | Upstream | Connection String/
>
> /----------+----------------|----------------|------------------------
> -------------------/
>
> /* master | itupl-postgen2 | | host=10.70.3.252
> dbname=repmgr user=repmgr/
>
> / standby | itupl-postgen1 | itupl-postgen2 | host=10.70.3.251
> dbname=repmgr user=repmgr/
>
> It is also showing correctly in repl_nodes table of the two databases.
>
> Why is it hanging?? Thank you for your help...

You are using -w

https://www.postgresql.org/docs/9.5/static/app-pg-ctl.html

"-w

Wait for the startup or shutdown to complete. Waiting is the default option for shutdowns, but not startups. When waiting for startup, pg_ctl repeatedly attempts to connect to the server. When waiting for shutdown, pg_ctl waits for the server to remove its PID file. This option allows the entry of an SSL passphrase on startup.
pg_ctl returns an exit code based on the success of the startup or shutdown.
"

So pg_ctl was trying to connect the server and did not find it at first:

"pg_ctl: PID file "/var/lib/pgsql/9.5/data/postmaster.pid" does not exist. Is server running?"

but continued with the process:

"starting server anyway"

FYI in Postgres 10+ -w is the default for pg_ctl.

>
> Here is the complete output:
>
> /----------------------------------------------- /
>

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2017-05-23 00:22:00 Re: issue performing a switchover with repmgr
Previous Message Adrian Klaver 2017-05-22 23:56:25 Re: logical replication in PG10 BETA