0

I am running Redis in sentinels mode, It has happened many times that I write data in Redis but while reading same key I don't get expected value.

I am wondering if it is possible when I write data it is written on Master and while reading it goes to slave but since Replication in Redis is asynchronous in nature all slaves are not updated and hence I don't get updated value/ valid value.

I am using redisson client and three servers for sentinel configuration.

Akshay Naik
  • 669
  • 1
  • 6
  • 22

1 Answers1

1

It's not possible. To overcome this you may choose from follow options:

  1. set readMode config parameter to MASTER
  2. use RBatch object with defined syncSlaves setting BatchOptions.syncSlaves(2, 10, TimeUnit.SECONDS)
Nikita Koksharov
  • 10,283
  • 1
  • 62
  • 71
  • we are using Redis for synchronization in tomcat cluster, so reading and writing data is very frequent, wouldn't be reading from the only master will be bottleneck. Wha does the 2nd option do? – Akshay Naik Jan 08 '20 at 06:20
  • wouldn't be reading from the only master will be bottleneck - depends on application load. Second option will finish batch execution only after slaves synchronization – Nikita Koksharov Jan 08 '20 at 14:06