简体   繁体   中英

How to failback with Postgresql cluster using repmgr?

I want to build a Postgresql Cluster in a Cloud environment (yes I know it's a bad idea... but that is not the question). For your information, I use a Dockerized Postgresql (see: https://github.com/paunin/postgres-docker-cluster ) but that is not the problem and not the question.

So I have installed 2 Postgresql 9.5 with streaming replication. On each host I have repmgr 3.2.1 installed and correctly configured.

The following case have some issue:

  1. stop the master,
  2. wait for failover on slave -> ok,
  3. restart the old master -> Ko I've got 2 master in the cluster showed by repmgr cluster show and I don't find any solution to force the old master to become slave.

The only ugly solution I found is to remove all data of the old master and restart it. Doing this, it became slave as expected (but a full resynchro is needed...).

Please note that It seems to be not possible to force the old master to became slave. repmgr standby register don't work as it says:

[2016-12-06 15:04:04] [INFO] connecting to standby database
[2016-12-06 15:04:04] [ERROR] this node should be a standby (user=replication_user password=replication_pass host=psg-host21 dbname=replication_db port=5432 connect_timeout=2)
[2016-12-06 15:04:04] [INFO] connecting to database
    Role      | Name       | Upstream   | Connection String
    ----------+------------|------------|------------------------------------------------------------------------------------------------------------------
    * master  | psg-host21 |            | user=replication_user password=replication_pass host=psg-host21 dbname=replication_db port=5432 connect_timeout=2
    * master  | psg-host22 | psg-host21 | user=replication_user password=replication_pass host=psg-host22 dbname=replication_db port=5432 connect_timeout=2

Any help would be greatly appreciated.

If you need high-available Postgres cluster managed by repmgr, you can use the pg-dock

This is tool for dockerizing the Postgres cluster with repmgr.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM