ReplicationIntermediate
1Question 1 of 1
bashHow does Master-Replica replication work in Redis?
Explanation & Concept
Redis replication is asynchronous. A primary master node continuously sends a stream of write commands to connected replicas.
• Replication buffer: Master maintains a backlog buffer to catch up briefly disconnected replicas via partial resynchronization (PSYNC). • Read scaling: Replicas accept read queries, offloading read volume from the master. • High availability: Paired with **Redis Sentinel** to automatically detect master failures and elect a replica as the new master.
Code Example
bash
# Configure replica node to follow master
REPLICAOF master.redis.internal 6379
# Confirm replication state
INFO replication
# Output:
# role:slave
# master_host:master.redis.internal
# master_link_status:upHow It Works & Key Takeaways
Replicas provide read scalability and redundancy. In the event of primary hardware failure, Sentinel promotes a replica to primary without manual intervention.
Mock Test · 1 Questions · Optional
Ready for Redis Cluster?
Take a quick test to evaluate yourself, or move straight to the next module.
Intermediate1 questions