1. Become a replica
REPLICAOF makes this node an asynchronous replica of the given master host and port.
REPLICAOF master 6379Typorithm · medium
Step 1 of 8 · intro card
Persistence & Scale
REPLICAOF turns a node into an async replica of a master (read scaling and failover); INFO replication shows role and lag; REPLICAOF NO ONE promotes a replica to master; WAIT blocks until N replicas ack writes for tunable durability. Replication is asynchronous by default, so a failover can lose un-acked writes.
REPLICAOF master 6379 makes the current node an asynchronous replica of the named master. Replicas copy the master's data and stay read-only, which scales reads and provides a standby for failover. INFO replication reports each node's role and how far a replica lags behind its master.
REPLICAOF NO ONE breaks the link and promotes a replica to a standalone master — the core of a manual failover. Because replication is asynchronous, writes acknowledged by the old master may not have reached the replica yet, so a failover can lose them.
WAIT 1 100 gives you tunable durability: it blocks until at least one replica acknowledges the preceding writes, or until the 100 ms timeout elapses. CONFIG GET reads runtime settings such as maxmemory, which you typically keep consistent across master and replicas.
REPLICAOF makes a node an async replica of a master.
REPLICAOF NO ONE promotes a replica to master.
WAIT blocks until N replicas ack the writes.
REPLICAOF master 6379
INFO replication
REPLICAOF NO ONE
WAIT 1 100
CONFIG GET maxmemoryConnect each part of the code to the concept before you type.
REPLICAOF makes this node an asynchronous replica of the given master host and port.
REPLICAOF master 6379INFO replication shows whether this node is a master or replica and how far behind it is.
INFO replicationREPLICAOF NO ONE detaches the replica and promotes it to an independent master.
REPLICAOF NO ONEWAIT blocks until at least 1 replica acknowledges the prior writes, or the 100 ms timeout passes.
WAIT 1 100CONFIG GET reads a runtime setting, here the memory limit, which should match across nodes.
CONFIG GET maxmemoryRead the concept map and follow the code breakdown.
Type the implementation, repair mistakes and work through every recall exercise.
Use the final check without hints; revisit weak concepts in short practice sessions.