Deploy
Cluster operations
Nexir uses explicit Raft membership commands. Mutating operations must run on the current leader and require server.enable_admin_commands=true.
Initialize a cluster
INIT node_id grpc_addr redis_addrRun INIT exactly once on one fresh node. It creates a one-voter cluster, mints a durable cluster UUID, and requires the argument node ID to match the configured node ID.
Add and promote a node
CLUSTER ADD 2 http://10.0.0.12:50051 10.0.0.12:6379 TIMEOUT 300000
CLUSTER PROMOTE 2ADD performs candidate identity and address checks, adds a learner, and waits for catch-up. If catch-up times out, the learner stays in membership; inspect it, then promote later or remove it. Promote only after CLUSTER MEMBERS shows it caught up.
View cluster state
CLUSTER INFO
CLUSTER MEMBERS
CLUSTER IDENTITY
CLUSTER STATUSINFOreports state, role, leader, UUID, term, indexes, voters, and joint membership.MEMBERSreports IDs, roles, advertised addresses, leader, matched indexes, and lag.IDENTITYreports the local configured ID, cluster UUID, and initialized flag.STATUSreturns serialized Raft metrics for diagnostics.
Change a node role
CLUSTER PROMOTE node_id
CLUSTER DEMOTE node_idDEMOTE keeps the node as a learner. Nexir refuses to demote the current leader or last voter. Transfer leadership first when necessary.
Remove a node
CLUSTER REMOVE node_idRemoval completely removes a learner or voter. It does not stop or fence the process. After success, stop the removed node and archive or destroy its old path. A process left running can still serve stale LOCAL reads.
Transfer leadership
CLUSTER TRANSFER-LEADER 2
# or select the most caught-up replacement automatically
CLUSTER STEPDOWNThe target must be a caught-up voter. During the election window, clients may receive MOVED or temporary retryable errors. Use planned transfer before leader maintenance or removal.
Update advertised addresses
- Stop the node.
- Restart with the same node ID and storage path, using the new bind addresses.
- Run
CLUSTER UPDATE-ADDR node_id grpc_addr redis_addrthrough the leader. - Verify
CLUSTER MEMBERSandCLUSTER INFO.
Nexir verifies that the process at the new peer address identifies as the same node in the same cluster.
Failure and quorum
A three-voter cluster can lose one voter and retain a majority. Loss of a majority makes writes and linearizable reads unavailable. Restore quorum if possible; online membership operations cannot commit without it.
Permanent majority loss
Nexir provides an offline, destructive-boundary recovery path that converts one chosen survivor into a new one-voter cluster identity:
nexir --accept-terms recover inspect --storage-path /var/lib/nexir-node1
nexir --accept-terms recover force-new-cluster --storage-path /var/lib/nexir-node1
nexir --accept-terms recover force-new-cluster --commit --confirm-node-id 1 \
--storage-path /var/lib/nexir-node1Stop and isolate every old node first. Inspect every reachable survivor and choose the highest last_log_id index, breaking ties with last_applied. Dry run before committing. The recovered cluster keeps everything present in the chosen survivor's log and applied state; acknowledged writes that existed only on dead nodes are irrecoverably lost. Re-add only wiped old nodes.
force-new-cluster cannot compare unavailable disks or restore a point in time. It changes the cluster UUID and must be run on exactly one stopped survivor.Client behavior during failover
Expect MOVED 0 <leader>, CLUSTERDOWN no known leader, or quorum errors. Every supported write touches one key and is idempotent when replayed with the same arguments, so a retry after an uncertain response is safe — except that a retried SET ... EX or EXPIRE restarts its deadline. Read back PTTL when the exact deadline matters.