Docs / Clustering Guide
Clustering Guide
Maree-DB clustering is an Enterprise tier feature. Clusters provide automatic failover, Byzantine fault tolerance, and horizontal scalability.
Requirement: Enterprise tier licence. Minimum 3 nodes recommended (allows 1 node failure tolerance). 5 nodes recommended for Byzantine fault tolerance (f = 1, n = 5, f < n/3).
Step 1: Prepare Each Node
Install Maree-DB on each node. Ensure all nodes can communicate on the cluster port (default 7001).
[cluster]
node_id = "node-1"
cluster_id = "prod-cluster-1"
port = 7001
seeds = [
"node-1.internal:7001",
"node-2.internal:7001",
"node-3.internal:7001"
]
byzantine_fault_tolerant = true
Step 2: Start the Bootstrap Node
maree-db-server start --bootstrap-cluster
Step 3: Join Remaining Nodes
maree-db-server start --join-cluster node-1.internal:7001
Step 4: Verify Cluster
maree-db-cli cluster status
SELECT * FROM _system.cluster_nodes;
Adding a Node
maree-db-server start --join-cluster node-1.internal:7001
maree-db-cli cluster status
Removing a Node
maree-db-cli cluster remove-node node-3
maree-db-cli cluster remove-node node-3 --force
Rolling Upgrades (Zero Downtime)
maree-db-cli cluster drain node-1
curl -sSL https://dist.mareedb.com/install.sh | bash
maree-db-server restart
maree-db-cli cluster status
maree-db-cli cluster undrain node-1
Byzantine Fault Tolerance
In Byzantine fault tolerant mode (5+ nodes), Maree-DB can maintain correctness even if up to f nodes are compromised or behaving maliciously, where f < n/3 (n = number of nodes).
- 5 nodes: tolerates 1 compromised node
- 7 nodes: tolerates 2 compromised nodes
- 10 nodes: tolerates 3 compromised nodes
[cluster]
byzantine_fault_tolerant = true
SELECT * FROM _system.consensus_status;
Cluster Monitoring
maree-db-cli cluster monitor
SELECT node_id, lag_ms, status
FROM _system.replication_status;
SELECT * FROM _system.quorum_status;