ERR redis runtime_error ai_generated true

Error: Replication sync failed, replica id mismatch, expected <replica_id> but got <replica_id>

ID: redis/sync-replica-id-mismatch

Also available as: JSON · Markdown · 中文
88%Fix Rate
85%Confidence
1Evidence
2023-11-15First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
6.2.0 active
7.0.0 active
7.2.0 active
7.4.0 active

Root Cause

During partial resynchronization, the replica's cached master replication ID does not match the current master's replication ID, often due to master restart or failover.

generic

中文

在部分重新同步期间,副本缓存的master复制ID与当前master的复制ID不匹配,通常是由于master重启或故障转移导致。

Official Documentation

https://redis.io/docs/management/replication/

Workarounds

  1. 95% success On the replica, run `SLAVEOF NO ONE` then `SLAVEOF <master_ip> <master_port>` to force a full resynchronization.
    On the replica, run `SLAVEOF NO ONE` then `SLAVEOF <master_ip> <master_port>` to force a full resynchronization.
  2. 85% success If using Redis Sentinel, trigger a manual failover: `redis-cli -p 26379 SENTINEL failover <mymaster>` to elect a new master and force replicas to sync with a fresh replication ID.
    If using Redis Sentinel, trigger a manual failover: `redis-cli -p 26379 SENTINEL failover <mymaster>` to elect a new master and force replicas to sync with a fresh replication ID.
  3. 90% success In a cluster environment, use `CLUSTER REPLICATE <node-id>` on the replica after ensuring the master is healthy and has a consistent replication ID.
    In a cluster environment, use `CLUSTER REPLICATE <node-id>` on the replica after ensuring the master is healthy and has a consistent replication ID.

中文步骤

  1. 在副本上运行 `SLAVEOF NO ONE` 然后 `SLAVEOF <master_ip> <master_port>` 以强制完全重新同步。
  2. 如果使用Redis Sentinel,触发手动故障转移:`redis-cli -p 26379 SENTINEL failover <mymaster>` 以选举新的master并强制副本使用新的复制ID同步。
  3. 在集群环境中,确保master健康且复制ID一致后,在副本上使用 `CLUSTER REPLICATE <node-id>`。

Dead Ends

Common approaches that don't work:

  1. 75% fail

    Restarting the replica without clearing its replication backlog or ID cache does not fix the underlying mismatch; the replica will retry with the same stale ID.

  2. 90% fail

    Manually setting repl-id using CONFIG SET on the master is risky and may break replication for other replicas; it does not address the root cause of ID divergence.

  3. 80% fail

    Increasing repl-backlog-size on the master alone does not resolve a mismatched replication ID; the replica must perform a full sync to reset the ID.