EnterpriseDB/repmgr

Can't start psql cluster after standby clone

Closed this issue · 3 comments

Hi,

After finishing the master registration I cloned the data to my slave cluster using the following command:

repmgr -h y.y.y.109 -U repmgr -d repmgr -p 5432 -F standby clone --without-barman

After it finished I tried to register it using repmgr standby -F register, but it fails with the following output:

INFO: connecting to local node "server-c" (ID: 2)
ERROR: unable to connect to local node "server-c" (ID: 2)
HINT: to register a standby which is not running, additionally provide the primary connection parameters

This is my slave configuration:

node_id=2
node_name=server-c
conninfo='host=x.x.x.154 user=repmgr dbname=repmgr port=5432'
data_directory='/var/lib/postgresql/9.5/main'
pg_bindir='/usr/lib/postgresql/9.5/bin'
log_file='/var/log/repmgr.log'

And this is the relevant part in pg_hba.conf on the primary server:

host replication replication 191.252.201.154/32 md5

host repmgr repmgr x.x.x.154/32 trust # slave ip
host replication repmgr x.x.x.154/32 trust #slave ip
host repmgr repmgr y.y.y.109/32 trust # master ip

Did I messed any configuration or am I missing some step?
Any help is appreciated.

Thanks.

Hi,

After finishing the master registration I cloned the data to my slave cluster using the following command:

repmgr -h y.y.y.109 -U repmgr -d repmgr -p 5432 -F standby clone --without-barman

After it finished I tried to register it using repmgr standby -F register, but it fails with the following output:

INFO: connecting to local node "server-c" (ID: 2)
ERROR: unable to connect to local node "server-c" (ID: 2)
HINT: to register a standby which is not running, additionally provide the primary connection parameters

(...)

Did I messed any configuration or am I missing some step?
Any help is appreciated.

You need to start the standby before registering it.

Regards

Ian Barwick

Hi @ibarwick and thanks for the reply.

You need to start the standby before registering it.

Even after starting the standby I get the same error:
image

Edit:
I'll wait a little bit for the recovery state to clear (or to get stuck), this is the psql log:

2020-09-29 11:06:51.838 -03 [57754] LOG:  entering standby mode
2020-09-29 11:06:51.843 -03 [57754] LOG:  redo starts at 9/1139ED30
2020-09-29 11:06:51.916 -03 [57754] LOG:  consistent recovery state reached at 9/11B5FE18
2020-09-29 11:06:51.917 -03 [57754] LOG:  record with incorrect prev-link 42001000/2EF25600 at 9/11B5FE18
2020-09-29 11:06:51.938 -03 [57757] LOG:  started streaming WAL from primary at 9/11000000 on timeline 1
2020-09-29 11:06:52.280 -03 [57758] [unknown]@[unknown] LOG:  incomplete startup packet
2020-09-29 11:06:52.811 -03 [57762] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:53.328 -03 [57765] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:53.844 -03 [57769] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:54.361 -03 [57772] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:54.878 -03 [57776] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:55.396 -03 [57779] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:55.914 -03 [57783] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:56.430 -03 [57786] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:56.945 -03 [57790] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:57.463 -03 [57793] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:57.981 -03 [57797] postgres@template1 FATAL:  the database system is starting up
2020-09-29 11:06:57.987 -03 [57798] [unknown]@[unknown] LOG:  incomplete startup packet

I found what was missing on postgresql.conf in the slave server:
hot_standby = on

After adding this line the server remained in recovery but now it can receive connections and process queries normally.

Thanks for the help.