# Quickstart: Raft Core Replication ## Prerequisites - Nix dev shell: `nix develop` - Ports available: 50051, 50052, 50053 (Raft/gRPC) - Clean data dirs for each node ## 1) Build & Unit Tests ```bash nix develop -c cargo build nix develop -c cargo test -p rdb-server -- service::tests::get_returns_value_and_version nix develop -c cargo test -p rdb-server -- peer::tests::single_node_propose_persists_log ``` ## 2) Start a 3-Node Cluster (manual) ```bash # Terminal 1 nix develop -c cargo run --bin rdb-server -- --addr 127.0.0.1:50051 --data-dir /tmp/rdb-node1 # Terminal 2 nix develop -c cargo run --bin rdb-server -- --addr 127.0.0.1:50052 --data-dir /tmp/rdb-node2 # Terminal 3 nix develop -c cargo run --bin rdb-server -- --addr 127.0.0.1:50053 --data-dir /tmp/rdb-node3 ``` ## 3) Propose & Verify (temporary approach) - Use the forthcoming integration harness (under `rdb-server/tests`) to: - Elect a leader (campaign) - Propose a command (e.g., `"hello"`) - Assert at least two nodes have the entry at the same index/term and commit - For now, run: ```bash nix develop -c cargo test -p rdb-server -- --ignored ``` (ignored tests will host the multi-node harness once added) ## 4) Recovery Check - Stop one follower process, keep leader + other follower running. - Propose another entry. - Restart the stopped follower with the same data dir; verify logs show catch-up and committed entries applied (via test harness assertions).