primary lagging behind recovery in postgres streaming replication

不想你离开。 提交于 2019-12-11 02:37:57

问题


I was doing a streaming replication between 3 nodes of postgresql-9.5 . 1 master and 2 slaves I was trying to configure auto failover but when i switched back to my original master, and restarted the postgres service, I am getting the following error:-

highest timeline 1 of the primary is behind recovery timeline 11

Can somebody please help. Thanx in advance


回答1:


I'm not sure what you exactly mean by "when i switched back to my original master", but it looks that you are doing the wrongest possible thing in PostgreSQL streaming replication - introducing the second master.

The most important thing you should know about PostgreSQL replication is that once the failover is performed, you cannot simply "switch back to original master" - there's now a new master in cluster, and existence of two masters will make damage.

After a slave is promoted to master, the only way for you to re-join the old master is to:

  1. Destroy it (delete the data directory);
  2. Join it as a slave.

If you want it to be master again you'll continue with the following:

  1. Let it run for awhile as a slave so that it can sync the data;
  2. Kill temporary master and failover to old master;
  3. Rejoin temporary master again as a slave.

You cannot simply switch master servers! Master can be created ONLY by failover (promoting a slave)

You should also know that whenever you are performing failover (whenever the master is changed), all slaves (except for the one that is promoted) need to be reconfigured to target the new master.

I suggest you reading this tutorial - it'll help.



来源:https://stackoverflow.com/questions/37140598/primary-lagging-behind-recovery-in-postgres-streaming-replication

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!