Akshay Naik
Akshay Naik

Reputation: 697

Is it possible read happens before replication when Redis is in sentinel mode?

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.

Upvotes: 0

Views: 422

Answers (1)

Nikita Koksharov
Nikita Koksharov

Reputation: 10783

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)

Upvotes: 1

Related Questions