Reputation: 1595
I have a scenario where we want to use redis
, but I am not sure how to go about setting it up. Here is what we want to achieve eventually:
A redundant central redis
cluster where all the writes will occur with servers in two aws
regions.
Local redis
caches on servers which will hold a replica of the complete central cluster.
The reason for this is that we have many servers which need read access only, and we want them to be independent even in case of an outage (where the server cannot reach the main cluster).
I know there might be a "stale data" issue withing the caches, but we can tolerate that as long as we get eventual consistency.
What is the correct way to achieve something like that using redis
?
Thanks!
Upvotes: 1
Views: 928
Reputation: 1595
So I decided to go with redis-sentinel
.
Using a redis-sentinel
I can set the slave-priority
on the cache servers to 0, which will prevent them from becoming masters.
I will have one master set up, and a few "backup masters" which will actually be slaves with slave-priority
set to a value which is not 0, which will allow them to take over once the master goes down.
The sentinel will monitor the master, and once the master goes down it will promote one of the "backup masters" and promote it to be the new master.
More info can be found here
Upvotes: 1
Reputation: 9307
You need the Redis Replication (Master-Slave) Architecture.
Redis replication is a very simple to use and configure master-slave replication that allows slave Redis servers to be exact copies of master servers. The following are some very important facts about Redis replication:
Go through the Steps : How to Configure Redis Replication.
Upvotes: 1