Closed rohitjoshi closed 8 years ago
The connection pool isn't aware of Redis roles, it's just a tcp socket connection pool. So if Sentinel tells you that host x
is master, then you can rely this, regardless of whether it has always been master or was formerly a slave. Just because Redis has promoted the role, doesn't mean that client connections behave any differently.
To put it another way, you can connect to a slave and then put that connection in the keepalive pool. Sentinel might then promote that slave to master. If you connect to a master, and receive the same host / port as the slave you used previously, the connection may be reused from the pool. But you can safely treat this connection as a master because Redis has promoted it.
Does that answer your question?
Thanks @pintsized
@pintsized thanks for adding support for the sentinel. If I want to use the redis slaves for the read and master for the write