Utilize Master do write operation and slave do read operation

Hi, i have been tried deploy redis HA in kubernetes environment like this:
image2021-11-12_13-19-43

But for sentinel Node we use services so application client connect to service name

  1. These are Pod of redis


  2. These are Services of redis

  3. We use redis-sentinel-app service for connect to redis POD (Master and Slave)

  4. We already refer to this link https://github.com/ServiceStack/ServiceStack.Redis#read-only-clients to use method GetClient for write operation and GetReadOnlyClient for read operation
    then we try check server role using method GetServerRole for make sure we use correct role.


    But why the log always show server role as master when use GetReadOnlyClient() method.

Is there something wrong with what we did?
We use ServiceStack.Redis.Core version 5.12.0

Thank you

RedisManagerPool only returns connections to read/write master, you’d need to leave RedisSentinel to use PooledRedisClientManager to return readonly slave connections.

Sorry do you mean like this
image

But how we manage in code if we leave RedisSentinel to use PooledRedisClientManage when Pod Master down and become to slave, then sentinel vote one of slave become master ?

And how about connection string because we connect to name of service? still use redis-sentinel-app service ?

Thank You

By default RedisSentinel is configured to use PooledRedisClientManager as its RedisManagerFactory, your screenshot with the red arrow points to where you’ve overridden it to use RedisManagerPool which only returns master connections. If you don’t override it, it will go back to using PooledRedisClientManager again.