title: Redis Sentinel is not switching to new master
body: <p>I want to implement <code>redis-sentinel</code>. Following code snippet shows what I have done:</p>
  <pre><code>import redis
  
  from redis.sentinel import Sentinel
  from .config import redis_config
  
  redis_client = None
  
  def create_redis_client():
  
      global redis_client
      SENTINEL_PORT = int(redis_config[&quot;redis.sentinel.port&quot;])
      sentinel = Sentinel([(redis_config[&quot;redis.server.master&quot;], SENTINEL_PORT),
                      (redis_config[&quot;redis.server.slave1&quot;], SENTINEL_PORT),
                      (redis_config[&quot;redis.server.slave2&quot;], SENTINEL_PORT)])
                      # sentinel_kwargs={&quot;password&quot;: redis_config[&quot;redis.server.password&quot;]})
      # you will need to handle yourself the connection to pass again the password
      # and avoid AuthenticationError at redis queries
      host, port = sentinel.discover_master(redis_config[&quot;redis.master.name&quot;])
      print(f&quot;Redis Sentinel Host: {host}&quot;)
      print(f&quot;Redis Sentinel Port: {port}&quot;)
      redis_client = redis.StrictRedis(
              host=host,
              port=port,
              password= redis_config[&quot;redis.server.password&quot;]
          )
  
  def get_redis_client():
      if redis_client is None:
          create_redis_client()
          return redis_client
      else:
          return redis_client
  </code></pre>
  <p>Here <code>redis_config</code> is nothing but a dictionary like this:</p>
  <pre><code># sentinel
  redis_config = {
      &quot;redis.server.master&quot;: &quot;MASTER_IP&quot;,
      &quot;redis.server.slave1&quot;: &quot;SLAVE_IP&quot;,
      &quot;redis.server.slave2&quot;: &quot;SLAVE_IP&quot;,
      &quot;redis.sentinel.port&quot;: &quot;26379&quot;,
      &quot;redis.master.name&quot;: &quot;mymaster&quot;,
      &quot;redis.server.password&quot;: &quot;SAMPLE_PASSWORD&quot;
  }
  </code></pre>
  <p>I followed <a href="https://stackoverflow.com/a/59842832/6907424">this</a> solution to implement <code>redis-sentinel</code>. But surprising enough suddenly I got the following error:</p>
  <pre><code>redis.exceptions.ReadOnlyError: You can't write against a read only replica.
  </code></pre>
  <p>It seems to be that the sentinel is not changing the master when any failure occurs. Why this is happening? It is not the first time this happened, this happened once more before. Is the implementation okay?</p>