How do you check the current replication status and role of a specific Redis instance, whether it is acting as a primary or a replica?
Short answer
You use the INFO REPLICATION command, which shows whether the instance is currently acting as a master or a replica, lists any connected replicas if it is a master, or shows the primary it is following along with the current replication offset and lag if it is itself a replica.
Advertisement
AModel answer
You use the INFO REPLICATION command, which shows whether the instance is currently acting as a master or a replica, lists any connected replicas if it is a master, or shows the primary it is following along with the current replication offset and lag if it is itself a replica.
Example
redis-cli info replication
Real-world example
A team troubleshooting a replication issue checks INFO REPLICATION on both servers, confirming the replica is correctly connected to the intended primary and identifying the current replication offset on each side.
Likely follow-ups
- What does the role field in this output actually indicate?
- How do you interpret the master_repl_offset and slave_repl_offset values together?
Related topics