MASTERDOWN error

A replica lost its link to its primary and is set not to serve data that may be out of date.

A replica returns this error when it has lost its connection to its primary, and its replica-serve-stale-data setting is no. With this setting, the replica refuses commands while it can't get updates from the primary. This way, it never answers with data that may be out of date.

MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.

In client libraries

Client libraryException or error typeMessage
redis-py MasterDownError Link with MASTER is down and replica-serve-stale-data is set to 'no'.
Jedis JedisDataException MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.
node-redis SimpleError
Test with err.message.startsWith('MASTERDOWN')
MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.
Lettuce
The async API wraps the exception in an ExecutionException (get()) or a CompletionException (join()).
RedisCommandExecutionException MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.
go-redis redis.Error
Test with redis.IsMasterDownError(err)
MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.
ioredis ReplyError
Test with err.message.startsWith('MASTERDOWN')
MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.
StackExchange.Redis
NRedisStack uses StackExchange.Redis, so it raises the same exceptions. The sync and async APIs raise the same exceptions.
RedisServerException MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.
Predis Predis\Response\ServerException
Test with $e->getErrorType() === 'MASTERDOWN'
MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'.
redis-rb Redis::ConnectionError MASTERDOWN Link with MASTER is down and replica-serve-stale-data is set to 'no'. (redis://<host>:<port>)
redis-rs
The sync and async APIs raise the same errors.
ErrorKind::Server(ServerErrorKind::MasterDown) MasterDown: Link with MASTER is down and replica-serve-stale-data is set to 'no'.

How to fix it

  1. On the replica, run INFO replication. master_link_status:down confirms that the link is down. master_host and master_port show the address of the primary that the replica is trying to reach.
  2. Check that the primary is running, and that the replica can reach it at that address.
  3. If the primary requires a password, check that the replica has it in its masterauth setting. If the primary uses access control list (ACL) users, set masteruser too. See Setting a replica to authenticate to a master.
  4. Look in the replica's log for the reason that the link failed.

If your app can use data that may be out of date, set replica-serve-stale-data yes, which is the default. The replica then keeps answering commands while the link is down.

RATE THIS PAGE
Back to top ↑