0

My test environment had network glitch over the weekend and I ended up having two Primary databases up and running in the cluster.

 ID | Name                              | Role    | Status    | Upstream | Location | Priority | Connection string
----+-----------------------------------+---------+-----------+----------+----------+----------+------------------------------------------------------------------------------------
 1  | node-1 | primary | ! running |          | default  | 100      | host=node-1 user=repmgr dbname=repmgr connect_timeout=2
 2  | node-2 | primary | * running |          | default  | 100      | host=node-2 user=repmgr dbname=repmgr connect_timeout=2

Is there a way to demote the new Primary back to Standby and resume WAL shipping instead of perform the Standby clone?

Postgres version: 10.7

Repmgr version: 4.3

1 Answer 1

0

the bad news is: so far as I know the only solution is to demote one of your primaries and re-clone.

the good news is: rsync should be able to do the cloning fairly quickly if most of the data is unalteted,

3
  • Thanks for the reply. What command that you use for re-clone? I need to clean up the $PGDATA and tablespace directories for using the standby clone command: repmgr -h node-01 -U repmgr -d repmgr -f /etc/repmgr.conf standby clone --force --fast-checkpoint
    – CJ Chang
    May 21, 2019 at 10:50
  • my answer if from my understanding of postgresql, repmgr seems to be capable of using rsync, but I don't know enough abput its internals to give detailed instruction there.
    – Jasen
    May 22, 2019 at 23:14
  • 1
    As far as I understood, the biggest issue seems to be that you could already have run into a split brain situation as both memebrs allow write operations. So you'd have to decide which server you want to rejoin in order to continue your work. Depending on the application, this could already be a show stopper. I suggest in case of a crash, that the Datanase should not come online automaticaly, but the admin should check and may be start the old primary as standby by hand, or try pg_rewind if there is a huge delta, or just simply do a standby clone
    – Daywalker
    Aug 25, 2021 at 8:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.