CrazyCoder
CrazyCoder

Reputation: 2605

Redis Master Slave Configuration

I am trying to set up a Master-Slave Redis setup with 1 Master and 2 Slaves and 3 Sentinel nodes. Could anyone clarify the below questions?

  1. What is the difference between replicaof and slaveof properties? Some articles that referred uses either of the above properties when setting up the slave node. So I am confused about which should be used in slave nodes.

  2. By default Redis uses asynchronous replication to replicate its data to Slave nodes. Is there a property to change this behaviour i.e. to synchronous replication? My application is read-intensive and the number of writes is less. So thinking if I can make writes as synchronous(Master to all online Slave) then I can read from slaves as well to handle the traffic.

  3. How to configure Spring boot project read from any nodes and write to master ? Currerntly, I am using RedisSentinelConfiguration() to create JedisConnectionFactory.

Thanks in advance

Upvotes: 0

Views: 1463

Answers (1)

for_stack
for_stack

Reputation: 23021

Not familiar with Spring, only answering the first two questions.

What is the difference between replicaof and slaveof properties?

These two terms have the same effect. replicaof is introduced since Redis 5. Check this for detail.

Is there a property to change this behaviour i.e. to synchronous replication?

There's no way to change that. The WAIT command can be used to mitigate the problem. Also you might want to try redisraft, however, it's still in experimental state.

Upvotes: 1

Related Questions