Reputation: 19
I am trying to write a golang application and its read intensive so I am using redis for caching.
I am planning to use redis sentinel and thinking of making write(to redis) through master and read (from redis) using 3 slaves.
But I am not getting any configs to specifically mention read from slaves and write from master.
I read an article which says by default sentinel will use master for writing and slave for reading, is it true? Can someone confirm please
need to confirm if redis-sentinel by default redirects all the write to master and read to slave
Upvotes: 0
Views: 77
Reputation: 7705
Welcome to Stack Overflow!
Redis Sentinel cannot be used in the manner you described. Sentinels are monitors, not proxies. They perform two general functions:
In a proper Sentinel deployment, client applications would connect to a Sentinel and perform a query to identify the current primary node, then it's the client's responsibility to send writes to that node (and if desired, send reads to any of the replica nodes). However, since a failover could happen at any time, you'd have to re-query the Sentinel frequently (this is especially important if a split-brain scenario occurs).
Alternatively, you could have a separate process query the Sentinels that tracks the previous primary node, so that when a failover is detected, it updates a DNS record that points to the current primary node. The same can be done with a DNS record for a replica node.
Upvotes: 0