I have a master and slave configured on different servers. When master is down, my slave becomes master and everything seems work as it is. BUT when master is recovered, I cant get any keys from the current master(which was slave at first).

Any helps? Thanks

有帮助吗?

解决方案

What probably happens is that the master recovers without reloading the data properly, and the slave syncs with its master, resetting all its data.

A better practice would be to either:

  1. if the master is down, treat the slave as a read only node, not adding any data to it. and make sure the master recovers all the data properly. This will mean no inconsistencies caused by the down time. This is of course only if you can afford read only operation.

  2. Or - when you fail over to the slave, treat it as the new master, and when the old master goes back up, it MUST become a slave and not assume its former role. Redis sentinel does that automatically for you.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top