1
votes

I am working on setting up a Redis Cluster.

My understanding is that if I have a 6 node cluster (3 masters, each with one slave), by default, all reads and writes will happen on the masters. If any of the masters fail, then a slave will get promoted to master.

I would like to be able to allow slaves to do some of the reading as well (it is okay if the reads are a little stale).

I saw that the cluster spec supports the READONLY flag. It sounds like I can use this to accomplish what I want. https://redis.io/commands/readonly

My question is, if I have a master and a slave, both of which can perform read operations, how is it decided which node (master or slave) is responsible for fulfilling the read operation? Is it some kind of round-robin approach? Is it up to the client to decide? If it helps, I am using ioredis as my client: https://github.com/luin/ioredis

1
redis cluster uses sharding redis.io/topics/cluster-tutorialc4f4t0r

1 Answers

0
votes

Found the answer: it depends on the client you are using. In the case of Ioredis, the options are documented here:

https://github.com/luin/ioredis#read-write-splitting