Skip to content

Ask the HotKV docs

Answers come only from these docs and can be wrong; check the linked pages before you rely on them.

REPLICAOF

Last updated
REPLICAOF host port
REPLICAOF NO ONE
Group
Server
Complexity
O(1)
Arity
3 (exactly, counting the command name)
Flags
admin
HotKV Cloud
All plans
On-Premise
no license needed

REPLICAOF host port makes the server a replica of the HotKV server at host and port, its client port. The replica copies the primary’s data, then follows every write. It replies OK at once and does the copy in the background; until it has finished, commands that read or write data get LOADING. A replica that already follows another server switches to the new one. Make it permanent with replicaof host port in the configuration file. See replication for setting up replicas.

REPLICAOF NO ONE makes a replica stop following its primary and become a primary itself, keeping its data. On a server that is already a primary it does nothing and replies OK. NO ONE is matched case-insensitively.

Only a HotKV server can be the primary: a replica pointed at a Redis or Valkey server stays in master_link_status:down, and the other way round too.

Case Reply (RESP2 and RESP3)
host port accepted, or NO ONE succeeded, or the server already is a primary Simple string OK
NO ONE failed Error ERR Replication could not start as primary, see the server log
Cluster mode Error ERR REPLICAOF not allowed in cluster mode.
127.0.0.1:8601> REPLICAOF 127.0.0.1 8600
OK
127.0.0.1:8601> ROLE
1) "slave"
2) "127.0.0.1"
3) (integer) 8600
4) "connected"
5) (integer) 38
127.0.0.1:8601> SET greeting hi
(error) READONLY You can't write against a read only replica.
127.0.0.1:8601> REPLICAOF NO ONE
OK
127.0.0.1:8601> SET greeting promoted
OK
127.0.0.1:8601> ROLE
1) "master"
2) (integer) 79
3) (empty array)

In HotKV Cloud, the CLI tab of the panel does not run REPLICAOF.

Redis 7 and Valkey 8 accept both forms at runtime, and HotKV does too. A HotKV replica cannot follow a Redis or Valkey primary. In cluster mode, use CLUSTER REPLICATE and CLUSTER FAILOVER, as in Redis.

SLAVEOF, ROLE, REPLICATION.FAILOVER, FAILOVER, Replication

In a cluster: Replicas and failover