Wiki Cluster
Operating a cluster
Bootstrapping a three-node Mirexa cluster, adding and draining nodes, rebalancing on demand, reading cluster state, what to alert on, and the upgrade caveats.
This page is the operator's path through a Mirexa cluster: the material to prepare, the
configuration each node needs, how to bring up three nodes, and the day-two operations — adding a
node, draining one, rebalancing, reading what the cluster thinks of itself, and what to alert on.
Everything here is done through the gRPC control API; mirexa-cli has no cluster commands. The
concepts behind each step are on the other pages of this section.
Before you start
You need, for every node:
-
A node id — an integer ≥ 1, unique, and stable for the node's life (its Raft state is keyed by it).
-
Four addresses peers and clients can actually dial — not
0.0.0.0, not:8080. A node registers its listen addresses verbatim as the addresses it advertises; there is no separate advertise setting, so a wildcard would send redirected clients and peers to the wrong host.Key Used by network.addr Clients (the data address redirects name) control.addr Other nodes (seeds, registration, heartbeats) and operators cluster.raft_ addr The Raft transport between members cluster.replication_ addr Copies pulling from primaries (mutual TLS) -
Replication certificates from one offline cluster CA:
bashmirexa-cli certs ca -dir ./pkibashmirexa-cli certs issue -dir ./pki -node-id 1 -hosts 10.0.0.1,node1.internalThis writes
ca.crt/ca.keyand, per node,node-<id>.crtandnode-<id>.key(mode 0600).-hostsmust list every address peers dial the node's replication listener at. Keepca.keyoffline. See mirexa-cli certs and TLS and certificates. -
A signing key and an admin token. Data-plane authentication is on by default, and a clustered node with no
security.auth.trusted_keysis refused at config load (a single node would generate its own issuer; in a cluster each node would trust a different one). A control listener on a routable address is also refused unlesscontrol.admin_authis on:bashmirexa-cli token keygen -name ops -dir ./keysbashmirexa-cli token issue -key ./keys/ops.key -perms ADMIN_CLUSTER -validity 1h > admin.tokenEvery node lists the public key under
security.auth.trusted_keys, and every node reads its own credential fromcluster.admin_token_file, re-read before every request. A token lives at most an hour, so run something (a cron job, a sidecar) that re-issues the file well before it expires; a node whose token lapses can no longer heartbeat and will be fenced. See Authentication and tokens.
A cluster confined to one host can keep
control.addron loopback and leave admin auth off. The repository's own multi-node tests do exactly that. Its nodes still need the sharedtrusted_keys, orsecurity.auth.enabled: false.
Configuration
The founding node (node 1). Values under partition, compression and the two marked
cluster-wide only seed the cluster's agreed settings; afterwards the agreed values win and a
differing YAML value is logged and ignored. Choose them before the first start — partition count,
liveness timeout and replication factor can never be changed.
storage:
data_dir: /var/lib/mirexa
network:
addr: "10.0.0.1:8080"
observability:
addr: "10.0.0.1:9100"
partition:
count: 4096 # cluster-wide, immutable
security:
auth:
trusted_keys:
- name: ops
public_key: "BASE64-OF-ops.pub"
control:
enabled: true # required: a clustered node registers and heartbeats through it
addr: "10.0.0.1:9090"
admin_auth: true # required for a routable control.addr
cluster:
enabled: true
node_id: 1
raft_addr: "10.0.0.1:7000"
initial_members:
1: "10.0.0.1:7000" # bootstrap: this node founds the cluster
liveness_timeout: 30s # cluster-wide, immutable
replication_factor: 3 # cluster-wide, immutable
admin_token_file: /etc/mirexa/admin.token
replication_addr: "10.0.0.1:7100"
replication_cert_file: /etc/mirexa/pki/node-1.crt
replication_key_file: /etc/mirexa/pki/node-1.key
replication_ca_file: /etc/mirexa/pki/ca.crt
strict_settings: true # refuse to start rather than run on local values
A joining node (node 2) differs in its addresses, its id, and its membership: seeds instead
of initial_members. Seeds are control addresses; one reachable seed is enough.
cluster:
enabled: true
node_id: 2
raft_addr: "10.0.0.2:7000"
seeds: ["10.0.0.1:9090"]
admin_token_file: /etc/mirexa/admin.token
replication_addr: "10.0.0.2:7100"
replication_cert_file: /etc/mirexa/pki/node-2.crt
replication_key_file: /etc/mirexa/pki/node-2.key
replication_ca_file: /etc/mirexa/pki/ca.crt
strict_settings: true
Never give a joining node an
initial_memberslist. A node with a member list bootstraps a new, separate cluster of its own, which looks healthy and replicates nothing.
The full list of cluster.* keys is in the Configuration reference.
Important ones not shown above: voters (3), max_concurrent_migrations (2), rebalance_auto
(false), scrub_bytes_per_second (8 MiB/s), copy_read_max_staleness (5s), join_timeout (1m),
settings_timeout (15s).
Bootstrapping three nodes
The tested path is one founder, then joiners:
- Start node 1. It bootstraps a one-voter group, seeds the cluster settings from its YAML,
registers itself, and places every partition — all on itself, because it is the only
ONLINEnode. Wait untilGetClusterStatusshows it as leader andmirexa_cluster_partitions_unassignedreads 0. - Start nodes 2 and 3 with
seedspointing at node 1 (and at each other, once running). Each is admitted as a non-voter, catches up, starts, and registersONLINE. The leader promotes them to voters once both are caught up — three voters, never two. - Copies. With
replication_factor: 3, the replication loop adds two copies of every partition, two ×max_concurrent_migrationsseeds at a time. Watchmirexa_cluster_copies_missingfall to 0. - Spread the primaries. Every primary is still on node 1. Either set
cluster.rebalance_auto: true, or read the plan and move partitions yourself (below). With in-sync copies everywhere, the rebalancer uses swaps, which move write load without copying data.
Bootstrapping three founders at once with identical initial_members is also supported by the
configuration, but how evenly the first placement spreads in that case depends on which nodes have
registered when the leader first places, and is unverified.
Talking to the control API
Use any gRPC client. With grpcurl and the schema from
this repository (server reflection is off by default, control.reflection):
grpcurl -plaintext -import-path proto -proto mirexa/control/v1/control.proto \
-H "authorization: Bearer $(cat admin.token)" \
10.0.0.1:9090 mirexa.control.v1.ClusterService/GetClusterStatus
Drop -plaintext and pass -cacert when control.use_tls is on (the control listener then uses
the data plane's TLS certificate). Mutating calls sent to a follower are refused with
FAILED_PRECONDITION and a NotLeader detail naming the leader's control address; send them
there. The Control-plane gRPC API lists every RPC and message.
Reading the cluster's state
| RPC | Answers | Consistency |
|---|---|---|
GetClusterStatus |
Leader, term, voters and non-voters, commit/applied index, counts | This node's local view — answers without a quorum |
ListNodes / GetNode |
Registry records: addresses, status, incarnation | Linearizable |
ListPartitions (optionally by node) / GetPartition |
Directory entries: primary, copies, in-sync set, epoch, divergent | Linearizable |
ListPartitionHealth (impaired_) |
serving / under_ / primary_ / unavailable, with failover candidates |
Linearizable |
ListMigrations |
Each intent with its derived step | Linearizable |
ListDrains |
Per draining node: primaries, copies and migrations left | Linearizable |
GetRebalancePlan |
The latest plan and when it was computed | The leader's last evaluation; ask the leader |
GetClusterConfig |
The agreed settings and their version (empty before any are agreed) |
The web dashboard shows a cluster view (totals and a per-node table)
when dashboard.upstream_addrs lists the nodes.
Day-two operations
Adding a node
Configure it like node 2 above and start it. It joins as a non-voter, may be promoted to voter, and receives copies if partitions are short of the replication factor. It receives no primaries until something moves them: run the rebalancer or move partitions by hand.
Rebalancing on demand
grpcurl ... mirexa.control.v1.ClusterService/GetRebalancePlan
grpcurl ... -d '{"partition_id": 17, "target_node_id": 3}' \
mirexa.control.v1.ClusterService/MigratePartition
MigratePartition returns at once; follow it with ListMigrations. Stop one with
AbortMigration (same two fields) — it stops future steps and undoes nothing. A plan of
FailedPrecondition means the leader cannot tell yet (a node has not reported, or write rates are
still warming up); it is not a balanced cluster. See
Moving partitions and rebalancing.
Draining and removing a node
grpcurl ... -d '{"node_id": 3}' mirexa.control.v1.ClusterService/DrainNode
The cluster moves the node's primaries, then its copies, decommissions it, removes it from the
voter set, and the process exits with status 0 on its own. Follow progress with ListDrains.
A dead node can be drained too; its primaries are failed over and its copies re-created elsewhere.
Afterwards, DeregisterNode removes its record and makes the id reusable. Budget about
⌈partitions ÷ max_concurrent_migrations⌉ × 6.6 s plus seed transfer time. See
Joining, draining and decommissioning nodes.
Rolling restarts
Restart one node at a time and wait for it to be ONLINE and its copies back in sync before the
next. A clean stop hands off first: it sheds new writes to its partitions, waits for in-flight
writes, and waits up to network.shutdown_timeout (30 s) for its copies to receive everything it
acknowledged. A node also waits up to that timeout for idle client connections to close, so plan
the orchestrator's grace period above it. A node that stays down longer than the liveness timeout
is fenced, and one liveness timeout later its partitions fail over.
Replacing a dead node
If a node will not return: its primaries fail over automatically to in-sync copies (about two
liveness timeouts). Its copies are not re-created while it stays registered — they still count
toward the replication factor. Drain it (DrainNode works on a node that is down) so its copies
move, then deregister it. Partitions with no in-sync copy stay unavailable until the node
returns.
What to alert on
| Metric | Alert when | Meaning |
|---|---|---|
mirexa_ |
> 0 | Data out of reach: no primary and no caught-up copy |
mirexa_ |
> 0 for longer than ~2 × liveness timeout | Failover should have restored these |
mirexa_ |
> 0 for long | Redundancy lost |
mirexa_ |
> 0 for long, or NaN | Below the replication factor |
mirexa_ |
0 on a node holding primaries | That node refuses its partitions |
mirexa_ |
0 | The control plane cannot commit |
sum(mirexa_ |
≠ 1 across the cluster | No leader, or a reporting problem |
mirexa_ |
> 0 | A requested move will not happen |
mirexa_ |
not falling | A migration is stuck |
mirexa_ |
approaching 2 × liveness timeout | A copy is about to leave the in-sync set |
mirexa_ |
> 0 for long | A rotten chunk no peer can repair |
mirexa_ |
within weeks of now | Rotate the node certificate (SIGHUP) |
mirexa_ |
> 0 with auto off | A rebalance is waiting for you |
Several of these read NaN, never zero, when a node cannot read its own control-plane state; alert on NaN too. Ready-made alert rules and dashboards live in the separate monitoring repository; see Monitoring and alerting and Metrics.
Upgrades
Mirexa refuses older on-disk and replicated formats rather than reading them with defaults, so an upgrade across a format change is not in place:
- Control-plane snapshot — format version 12. An older snapshot is refused at startup, and a
settings entry from an older build is refused as truncated. A cluster's
raft/directories do not survive an upgrade across a snapshot or command format change. stream.idx— version 5; version 4 is refused.- Wire protocol — version 2, with no version-1 interoperation.
- Replication schema —
mirexa.replication.v1changes additively only within v1.
No in-place or rolling upgrade path exists across such a change; an upgrade that changes one of these formats means a fresh cluster loaded from your source data (for example with mirexa-cli load). Check which formats changed before upgrading. See On-disk formats.
Known limitations to plan around
- A cutover of a heavily written partition freezes its writes for as long as its copy lags — tens of seconds at hundreds of thousands of candles per second.
- A completed migration frees no disk on its source: files are moved under
quarantine/, and nothing deletes a quarantine. - A node with many streams takes a long time to stop cleanly (about 45 ms per stream with buffered data, measured 2026-10-20 on one laptop).
- No zone or rack awareness in placement.
- The replication factor, partition count and liveness timeout cannot be changed after bootstrap.
See Known limitations.
References
Source
ClusterConfig,ControlConfig, defaults- Startup and
shutdown, registration addresses,resolveClusterSettings,startClusterReconcilers requireLoopback,AdminAuthmirexa-cli certs,mirexa-cli token- Control API schema
- Snapshot version,
stream.idxversion - Metric catalog
Tests
- The
binaryClusterharness and its compositions (join, rebalance, scale up and down, rolling restart, live migration) — /tests/server_binary_cluster_test.go TestServerBinary_AnAuthenticatedClientWritesAndReadsBackAHundredStreamsAcrossThreeNodes— /tests/server_binary_auth_cluster_test.goTestServerBinary_ADecommissionedNodeExitsOnItsOwn— /tests/server_binary_decommission_test.goTestResolveClusterSettings_RefusesAConfigurationTheClusterWouldRefuse— /cmd/server/settings_test.goTestControlServer_ServiceSurfaceIsPinned— /internal/control/server_test.go
Further reading
External
grpcurl— https://github.com/fullstorydev/grpcurl- Prometheus, "Alerting rules" — https://prometheus.io/docs/prometheus/latest/configuration/alerting_rules/