Clustering & High Availability
KalamDB includes built-in clustering with high availability using Raft consensus. The cluster coordinates metadata and data placement while ensuring durability and failover.
Key Features
- Raft-based consensus for leader election and log replication
- Multi-Raft groups for sharding and scaling
- Automatic failover to keep the cluster available
- Snapshots and backups for recovery and fast restarts
Cluster Commands
-- List cluster nodes
CLUSTER LIST;
-- Check cluster health
CLUSTER STATUS;
-- Create a snapshot
CLUSTER SNAPSHOT;
-- Trigger a leader election
CLUSTER TRIGGER ELECTION;
-- Transfer leadership to a specific node
CLUSTER TRANSFER LEADER 2;
-- Step down as leader
CLUSTER STEPDOWN;
-- Purge old log entries
CLUSTER PURGE --UPTO 1000;Deploying a 3-Node Cluster
The quickest way to start a cluster is with Docker:
KALAMDB_JWT_SECRET="$(openssl rand -base64 32)" \
curl -sSL https://raw.githubusercontent.com/jamals86/KalamDB/main/docker/run/cluster/docker-compose.yml | docker-compose -f - up -dBackup & Restore
-- Backup a namespace
BACKUP DATABASE myapp TO '/backups/myapp-2026-02-18';
-- Restore from backup
RESTORE DATABASE myapp FROM '/backups/myapp-2026-02-18';
-- View backup history
SHOW BACKUPS FOR DATABASE myapp;Last updated on