Configure fallback redis server

master-slaveredisredundancy

I am using redis as a cache server. Can I somehow configure multiple redis servers, that the cache is fully functional (read/write) even if some of them go offline?

I looked into master->slave, but the problem I see there is, that if the master fails, and I allow writes to the slaves, they get overwritten once the master is up again. Now the master just serves the old data.

The only solution I could come up was disabling write-to-disc, but that sucks as I loose everything if I have to restart the master. And I guess, slaves wouldn't be synced anymore if the master is gone.

Best Answer

There is no master-master setup in Redis.
What happens when your master server is going offline and you allow writes to the slave server:
The slave server becomes the master.

Obviously this requires changes of the configuration (can be done runtime).
And when you bring back the old-master you must sync the changes from the new-master.

Simply bringing up the master after a downtime would result in inconsistencies.

There is an nice explanation how to restart Redis without downtimes or data-loss:
http://redis.io/topics/admin