Configure a node as replica of a primary node.
CLUSTER
REPLICATE
node-id
The command reconfigures a node as a replica of the specified primary. If the node receiving the command is an empty primary, as a side effect of the command, the node role is changed from primary to replica.
Once a node is turned into the replica of another primary node, there is no need to inform the other cluster nodes about the change: heartbeat packets exchanged between nodes will propagate the new configuration automatically.
A replica will always accept the command, assuming that:
If the node receiving the command is not already a replica, but is a primary, the command will only succeed, and the node will be converted into a replica, only if the following additional conditions are met:
If the command succeeds the new replica will immediately try to contact its primary in order to replicate from it.
Simple string
reply: OK
if the command was successful. Otherwise an
error is returned.
O(1)
@admin @dangerous @slow
ASKING, CLUSTER, CLUSTER ADDSLOTS, CLUSTER ADDSLOTSRANGE, CLUSTER BUMPEPOCH, CLUSTER COUNT-FAILURE-REPORTS, CLUSTER COUNTKEYSINSLOT, CLUSTER DELSLOTS, CLUSTER DELSLOTSRANGE, CLUSTER FAILOVER, CLUSTER FLUSHSLOTS, CLUSTER FORGET, CLUSTER GETKEYSINSLOT, CLUSTER HELP, CLUSTER INFO, CLUSTER KEYSLOT, CLUSTER LINKS, CLUSTER MEET, CLUSTER MYID, CLUSTER MYSHARDID, CLUSTER NODES, CLUSTER REPLICAS, CLUSTER RESET, CLUSTER SAVECONFIG, CLUSTER SET-CONFIG-EPOCH, CLUSTER SETSLOT, CLUSTER SHARDS, CLUSTER SLOT-STATS, CLUSTER SLOTS, READONLY, READWRITE.