Deploy a Cluster
Build the binaries and run a three-node Apache Iggy cluster
Build iggy-server and the iggy CLI, run a single development node, then bring up a three-node cluster on one machine. See Configuration for the full [cluster] reference.
Build from source
Build the server and CLI from the repository root:
cargo build --release --bin iggy-server --bin iggyThe binaries are:
target/release/iggy-server
target/release/iggyThe server uses Linux io_uring. Use a recent Linux kernel and a sufficient locked-memory limit.
Run one development node
The default core/server/config.toml has clustering disabled, so a plain run starts a single node:
cargo run --release --bin iggy-server -- --with-default-root-credentials--with-default-root-credentials sets the root user to iggy/iggy unless IGGY_ROOT_USERNAME and IGGY_ROOT_PASSWORD are already exported. These values initialize the root user only on its first creation. Later starts recover the stored user. Supplied environment values are still validated at boot.
When clustering is disabled, --replica-id 0 is still accepted. Any other id is rejected because it would have to match a cluster.nodes entry.
Run a three-node cluster
Every node loads the same configuration. Nodes are told apart only by --replica-id, which selects a static node's own entry in the cluster.nodes roster. A joining node uses its reserved slot outside the roster.
Save this as /tmp/iggy-vsr.toml:
[cluster]
enabled = true
name = "iggy-vsr-dev"
[cluster.auth]
enabled = true
shared_secret = ""
[[cluster.nodes]]
name = "iggy-node-1"
ip = "127.0.0.1"
replica_id = 0
ports = { tcp = 8090, quic = 8080, http = 3000, websocket = 8093, tcp_replica = 9090 }
[[cluster.nodes]]
name = "iggy-node-2"
ip = "127.0.0.1"
replica_id = 1
ports = { tcp = 8091, quic = 8081, http = 3001, websocket = 8094, tcp_replica = 9091 }
[[cluster.nodes]]
name = "iggy-node-3"
ip = "127.0.0.1"
replica_id = 2
ports = { tcp = 8092, quic = 8082, http = 3002, websocket = 8095, tcp_replica = 9092 }
cluster.nameis a permanent on-disk identity. It is hashed into the cluster id stamped into every metadata and partition superblock on first boot. Changing the name later makes the server refuse to start against the existing data, so renaming a cluster means starting from an empty data directory.
Export the settings shared by all three processes:
export IGGY_CONFIG_PATH=/tmp/iggy-vsr.toml
export IGGY_ROOT_USERNAME=iggy
export IGGY_ROOT_PASSWORD=iggy
export IGGY_CLUSTER_AUTH_SHARED_SECRET="replace-with-at-least-32-random-bytes"
export IGGY_SHARDING_CPU_ALLOCATION=2
export IGGY_SHARDING_PIN_CORES=falseRoot credentials are mandatory on the first boot of each replica when clustering is enabled. Restarts recover the stored root user. The shared secret must be at least 32 bytes. See Security for how it's used and rotated.
The two sharding settings give each replica two unpinned shards. By default every replica starts one pinned shard per core, so three replicas on one machine compete for the same cores.
Start each replica in a separate terminal. Use a different data path for every process, outside the local_data directory of the development node, because --fresh on that node deletes everything in it:
# Replica 0
IGGY_PATH=local_data_cluster/node-0 ./target/release/iggy-server --replica-id 0
# Replica 1
IGGY_PATH=local_data_cluster/node-1 ./target/release/iggy-server --replica-id 1
# Replica 2
IGGY_PATH=local_data_cluster/node-2 ./target/release/iggy-server --replica-id 2The exported settings must be present in all three terminals.
In cluster mode:
--replica-idis required and must match exactly onecluster.nodesentry unlesscluster.join.enabledis set for a reserved slot outside the rosterreplica_idvalues must be unique and contiguous from0portsis the single source of listener ports: every enabled transport needs an explicit per-node port, otherwise the server refuses to starttcpandtcp_replicaports are always required, even when client TCP is disabled.tcp_replicacarries replica-to-replica consensus trafficipmust be a literal IP address. Useadvertised_addresswhen clients can't reach it (see Configuration)- use a different root
pathfor each process on the same host
Spanning multiple hosts
The roster ip is the address other replicas dial. It's not the bind interface for the client transports: tcp, quic, http, and websocket bind whatever their own address settings say, and the roster supplies only the port. The defaults listen on loopback, so a cluster spread across hosts needs each transport's address set to 0.0.0.0 or the routable interface. The server warns at startup when a bind cannot serve the advertised ip.
Containers
Every roster field can be provided through typed environment variables instead of TOML, which suits container deployments:
IGGY_CLUSTER_ENABLED=true
IGGY_CLUSTER_NAME=my-cluster
IGGY_CLUSTER_NODES_0_NAME=node-1
IGGY_CLUSTER_NODES_0_IP=172.28.0.101
IGGY_CLUSTER_NODES_0_REPLICA_ID=0
IGGY_CLUSTER_NODES_0_PORTS_TCP=8090
IGGY_CLUSTER_NODES_0_PORTS_QUIC=8080
IGGY_CLUSTER_NODES_0_PORTS_HTTP=3000
IGGY_CLUSTER_NODES_0_PORTS_WEBSOCKET=8093
IGGY_CLUSTER_NODES_0_PORTS_TCP_REPLICA=9090
IGGY_CLUSTER_NODES_1_NAME=node-2
IGGY_CLUSTER_NODES_1_IP=172.28.0.102
IGGY_CLUSTER_NODES_1_REPLICA_ID=1
IGGY_CLUSTER_NODES_1_PORTS_TCP=8090
IGGY_CLUSTER_NODES_1_PORTS_QUIC=8080
IGGY_CLUSTER_NODES_1_PORTS_HTTP=3000
IGGY_CLUSTER_NODES_1_PORTS_WEBSOCKET=8093
IGGY_CLUSTER_NODES_1_PORTS_TCP_REPLICA=9090
IGGY_TCP_ADDRESS=0.0.0.0:8090
IGGY_QUIC_ADDRESS=0.0.0.0:8080
IGGY_HTTP_ADDRESS=0.0.0.0:3000
IGGY_WEBSOCKET_ADDRESS=0.0.0.0:8093
IGGY_CLUSTER_AUTH_ENABLED=true
IGGY_CLUSTER_AUTH_SHARED_SECRET=replace-with-at-least-32-random-bytes
IGGY_ROOT_USERNAME=iggy
IGGY_ROOT_PASSWORD=iggyGive each container a static IP and put that IP in the roster: cluster.nodes[*].ip does not accept hostnames or Docker service names. The repository ships a working reference in bdd/docker-compose.cluster.yml, a real two-node cluster used by the BDD suites.
Clients outside the Docker network
TCP, QUIC and WebSocket clients read the roster from cluster metadata and dial each node at the address it advertises. A client with no route to the container IPs, such as one on a Docker Desktop host or on another machine, reaches the nodes only through published ports. With more than one node, login and metadata reads still work for it, but sends, polls and some writes fail with Request transiently not accepted; retry, on any replica (TransientNotAccepted, code 58).
For such clients:
- set
advertised_address(IGGY_CLUSTER_NODES_<N>_ADVERTISED_ADDRESS) on every node to the address the client dials, for example127.0.0.1for ports published to the host - give each node its own port for every transport, because nodes behind one advertised address cannot share a port
- publish every client port under the same number, for example
-p 8090:8090for the first node and-p 8091:8091for the second, with/udpfor QUIC
advertised_address is a catch-all, so clients on the Docker network receive it too and dial their own loopback. If clients also run there, add an advertised_addresses selector whose client_cidr covers them and whose address is the node's ip. Keep the Docker gateway outside that range, because clients that come through a published port arrive from the gateway address.
docker-compose.cluster.yml in the repository root is a three-node cluster set up this way. Set IGGY_VERSION to your server version, because the file at that tag defaults to the 0.9.0 image. See advertised_address in Configuration for the details.
Check cluster metadata
Ask any node for the cluster state with the CLI:
./target/release/iggy \
--tcp-server-address 127.0.0.1:8090 \
-u iggy \
-p iggy \
cluster metadataThe response lists the cluster name, nodes, client endpoints, and current roles. cluster m is a shorthand for cluster metadata. Its status column comes from configuration, not from observation: every configured node reads healthy.
Check cluster members
A user with the manage_servers permission reads what the metadata primary observes of each node:
./target/debug/iggy \
--tcp-server-address 127.0.0.1:8090 \
-u iggy \
-p iggy \
cluster membersEach node shows the membership it is meant to have, the membership the metadata group committed, and its reachability with the age of its last answer, kept apart. The header names the node that observed, its role and the metadata view. Only the metadata primary holds fresh evidence: ask it, or a backup reports every other node as unknown. Missing or stale evidence reads as unknown. cluster operation shows the operation in progress and the first thing it waits for.
Reset a replica
iggy-server --fresh deletes the configured data directory before boot. In cluster mode this wipes that replica only: it rejoins the cluster and refills its state by transfer from the other replicas. Wiping a quorum of replicas at the same time destroys committed data, and a service unit that always passes --fresh re-transfers the whole dataset on every restart.
Start every configured metadata voter for the first bootstrap. The first election retains node 0 as the metadata primary. Once the group establishes its history, live voters can fail over with a quorum. After a full cluster shutdown, bring every voter back for recovery.
For rolling restart checks, quorum requirements and recovery of a refused copy, follow Release compatibility.
Retire a lost voter
A restarted voter rejoins only after every other voter of its groups answered it. If one voter is lost for good while another restarts, the restarted one waits for the lost one and logs Node 1 waits for nodes [2]. Restart the waiting voter with the ID of the lost one:
./target/debug/iggy-server --replica-id 1 --lost-voter 2Every other live voter retires node 2 only while its own replica link to node 2 is down and the voters left still form a view-change quorum. It records the retirement in retired.nodes in its data directory before it answers, and logs retires node 2 as lost. Once every live voter retired it, the waiting voter adopts the retirement and logs binds view ... without nodes [2].
Retiring a voter gives up any operation that only it and writes the restarted node lost held, so use it only for a voter whose disk will not return. Every voter refuses a retired node until it restarts with an empty data directory. If its old disk comes back, that node logs that it was retired and asks for its data directory to be emptied. Start it with --fresh, or put an empty data directory at the same node ID and replica address, and it rejoins as an in-place replacement. Do not keep --lost-voter in a restart service command.
Run the cluster test suites
The cross-SDK BDD suites use a standalone server for basic features and add the two-node cluster from bdd/docker-compose.cluster.yml for leader_redirection or all. The script packs the debug binaries into the server image and does not build them, so build them first:
cargo build --bin iggy-server --bin iggy
./scripts/run-bdd-tests.sh rust
./scripts/run-bdd-tests.sh rust basic_messaging
./scripts/run-bdd-tests.sh rust leader_redirectionThe first argument selects the SDK (rust, python, php, go, go-race, node, csharp, java, cpp, swift, or all) and the optional second argument selects one feature (basic_messaging, leader_redirection, raw_command, session_contract, stream_crud, stream_options, resource_options_patch, metadata_changes, deferred_polling, or all).
leader_redirection is the clustered feature. Coverage depends on the selected SDK and feature. Use --help for the runner's current selections.
