Multi-Raft Cluster Deployment and Scaling

Updated:
Author: Erkin Khidirov

In ModeCluster, Slyber DB coordinates nodes using Multi-Raft consensus, distributed 2PC SSI transactions, and automatic client-side partition leader routing. A 3-node cluster with a replication factor of 3 survives the complete loss of any server with zero data loss and uninterrupted writes.

Step 1. Distribute Shared Secrets Across All Nodes

Copy identical client.secret, admin.secret, and inter-node cluster.secret files to all three servers (10.0.1.11, 10.0.1.12, 10.0.1.13):

Bash
mkdir -p /etc/sldb /var/lib/sldb
chmod 700 /etc/sldb /var/lib/sldb

openssl rand -hex 24 > /etc/sldb/client.secret
openssl rand -hex 24 > /etc/sldb/admin.secret
openssl rand -hex 24 > /etc/sldb/cluster.secret
chmod 600 /etc/sldb/*.secret

The local disk encryption key (aes256.key) can be shared or unique per physical server because inter-node snapshot transfers (PEX2 / GSN2) stream decrypted payloads inside mutually authenticated TLS 1.3 tunnels.

Step 2. Start the Daemon on Each Node

The --shards and --groups settings must match across every node in the cluster (respecting the shard alignment invariant, e.g., 16 shards and 64 replica groups), while --node-id must be unique (1, 2, 3).

Node 1 (10.0.1.11)

Config
slyber_db \
  --mode=cluster \
  --node-id=1 \
  --data-dir=/var/lib/sldb \
  --addr=10.0.1.11:9110 \
  --cluster-addr=10.0.1.11:9111 \
  --admin-addr=10.0.1.11:9095 \
  --sync-mode=full \
  --shards=16 \
  --groups=64 \
  --client-secret-file=/etc/sldb/client.secret \
  --admin-secret-file=/etc/sldb/admin.secret \
  --cluster-secret-file=/etc/sldb/cluster.secret \
  --encryption-key-file=/etc/sldb/aes256.key
  • Node 2 (10.0.1.12): identical flags with --node-id=2, --addr=10.0.1.12:9110, --cluster-addr=10.0.1.12:9111, and --admin-addr=10.0.1.12:9095.
  • Node 3 (10.0.1.13): identical flags with --node-id=3, --addr=10.0.1.13:9110, --cluster-addr=10.0.1.13:9111, and --admin-addr=10.0.1.13:9095.

If the nodes were installed via the Linux installer script, configure the matching SLYBER_DB_* variables inside /opt/slyber_db/.env and run sudo systemctl restart slyber_db.

Step 3. Bootstrap Initial Topology (POST /v1/admin/topology)

Fresh nodes start without TOPOLOGY.bin and wait for the initial cluster map. Generate a JSON payload defining all 3 nodes and 64 replica groups (0..63) with members [1, 2, 3], then post it to port :9095 on each node:

Bash
ADMIN_TOKEN=$(cat /etc/sldb/admin.secret)

python3 - <<'EOF' > topology.json
import json

topo = {
    "epoch": 1,
    "nodes": [
        {"node_id": 1, "client_addr": "10.0.1.11:9110", "cluster_addr": "10.0.1.11:9111", "admin_addr": "10.0.1.11:9095"},
        {"node_id": 2, "client_addr": "10.0.1.12:9110", "cluster_addr": "10.0.1.12:9111", "admin_addr": "10.0.1.12:9095"},
        {"node_id": 3, "client_addr": "10.0.1.13:9110", "cluster_addr": "10.0.1.13:9111", "admin_addr": "10.0.1.13:9095"},
    ],
    "groups": [{"group_id": gid, "members": [1, 2, 3]} for gid in range(64)]
}
print(json.dumps(topo, indent=2))
EOF

for HOST in 10.0.1.11 10.0.1.12 10.0.1.13; do
  curl -sk -X POST "https://${HOST}:9095/v1/admin/topology" \
    -H "Authorization: Bearer ${ADMIN_TOKEN}" \
    -H "Content-Type: application/json" \
    --data-binary @topology.json
done

What Happens Inside Each Node

  1. The topology map is validated against the shard alignment invariant and atomically persisted to data/TOPOLOGY.bin with a CRC32C checksum.
  2. All 64 Multi-Raft groups start, establish mutually authenticated TLS 1.3 connections over port :9111, run PreVote → Vote, and elect group leaders within milliseconds.
  3. On subsequent restarts, calling /v1/admin/topology is no longer required: nodes automatically load TOPOLOGY.bin, restore persisted HardState and AppliedState from system namespace 0xFFFF, replay the tail of wal_*.log, and rejoin quorum.

Scaling Beyond 3 Nodes

When scaling to 6 nodes, you do not need to replicate every group across all 6 machines: place the first 32 replica groups on nodes [1, 2, 3] and the remaining 32 groups on nodes [4, 5, 6] while incrementing epoch in /v1/admin/topology. Network clients using the Go SDK automatically discover all 6 nodes via OpClusterNodes and route requests for each of the 4096 virtual partitions directly to the leader of its replica group.

To rebalance individual hot partitions between groups without pausing writes, use live partition migration covered in Day-2 Operations.

Time Synchronization Requirement

Hybrid Logical Clocks (HLC) bound physical clock skew across cluster nodes to MaxClockDrift = 500ms. Ensure chrony or systemd-timesyncd is active on every host; otherwise packets from drifted nodes are rejected with ErrClockSkew.