Wiki Reference
mirexa-server
The Mirexa node binary — its flags, environment overrides, signals, exit statuses, the listeners it opens and the files it writes.
mirexa-server is the Mirexa node: one process that takes writes, answers queries, serves
subscriptions and, when clustering is on, takes part in the control plane and replication.
Every node runs the same binary. This page is the reference for how it is started and
stopped; what to put in its configuration is on the
configuration reference, and the order of what happens at
startup and shutdown is on Startup, shutdown and recovery.
Names
The source is /cmd/server. make build runs go build -o bin/ ./cmd/...,
which writes it as bin/server; the container image installs it as
/usr/local/bin/mirexa-server and starts it with -config /etc/mirexa/node.yaml.[1]
Both are the same program. Its own error messages begin mirexa:.
Usage
mirexa-server -config /etc/mirexa/node.yaml
mirexa-server -data-dir /var/lib/mirexa
| Flag | Default | Meaning |
|---|---|---|
- |
none | YAML configuration file. Without it the node runs on built-in defaults plus environment overrides. With it, the file is also watched for changes. |
- |
none | Overrides storage.. |
-, - |
Prints the flag list and exits 0. |
There are no other flags; everything else is configuration.
How the configuration is resolved
In order, each later source overriding the earlier:[2]
- built-in defaults (
config.Default); - the YAML file, if
-configis given; MIREXA_*environment variables;-data-dir.
The result is then validated as a whole, and the node refuses to start on an invalid
configuration or with no data directory at all ("no data directory: set storage.data_dir in
the config file or pass -data-dir"). An environment variable that does not parse is a
warning on standard error ([config warning] ...), not a failure: the variable is ignored.
TestLoad_Precedence and TestDefaultWithEnv_AppliesEnv cover the ordering.
Environment variables
Only these settings can be overridden from the environment (the list is what /internal/config/loader.go reads):
| Section | Variables |
|---|---|
| partition | MIREXA_ |
| network | MIREXA_, _, _, _, _, _, _, _, _, _, _, _, _ (each prefixed MIREXA_) |
| observability | MIREXA_, _, _, _ |
| storage | MIREXA_, MIREXA_, MIREXA_ |
| compression | MIREXA_ |
| security | MIREXA_, _, _, _, _, _, _ (each prefixed MIREXA_) |
| wal | MIREXA_, _, _, _, _, _, _, _, _, _, _ (each prefixed MIREXA_) |
| ingestion | MIREXA_, _, _, _, _, _, _, _, _, _ (each prefixed MIREXA_) |
| logging | MIREXA_, _, _, _, _, _, _, _, _ (each prefixed MIREXA_) |
Authentication, the control listener, clustering and the dashboard have no environment
overrides; set them in the file. Durations take Go syntax (30s, 5m).
What it opens
| Listener | Setting | Default | Notes |
|---|---|---|---|
| Wire protocol (data) | network. |
: |
Writes, queries, subscriptions. TLS when security.. |
| Metrics and probes | observability. |
: |
GET /, / (liveness), / (readiness). Binds every interface by default. |
| Control (gRPC) | control. |
127. |
Only when control.. See Control-plane gRPC API. |
| Consensus (Raft) | cluster. |
none; required when clustering is on | Only when cluster.. |
| Replication (mTLS gRPC) | cluster. |
none | Only on a clustered node that sets it; mutual TLS with node certificates from mirexa-. |
Two of a node's listeners on one port are refused when the configuration is validated, and a metrics listener that cannot bind stops the node at startup rather than leaving it running without
/metrics,/healthor/ready.[3]
/ready reports the data listener's own state and free space in the data directory, and
turns false at the first step of a shutdown so a load balancer stops routing there before the
data plane goes away.
Signals
| Signal | Effect |
|---|---|
SIGTERM, SIGINT |
Graceful shutdown (below), then exit 0. |
SIGHUP |
Reload; never stops the node. Logs "SIGHUP received: reloading the config file and any TLS certificates; the node keeps running", re-reads the configuration file at once (with -), and reloads the data listener's TLS certificate and key from their files, when security., and the replication listener's node certificate, when clustering is on. Live connections keep the certificate they handshook with; new handshakes get the new one. A failed reload is printed to standard error ([tls error] certificate reload failed:) and the old certificate stays in use. |
SIGHUP is caught from the start of the process to its end, on every node.[4] Until
2026-10-30 only the certificate reloaders caught it, so on a node with
security.tls_enabled: false and clustering off it ended the process at once, with no drain
and no handoff (TestServerBinary_SIGHUPReloadsAndNeverStopsTheNode).
With -config the file is also watched, so a change is picked up without a signal; SIGHUP
makes it immediate, which matters for a file that is a symlink into another directory (a
Kubernetes ConfigMap mount), whose change no file event names. Of every setting only
logging.level is applied while running; any other change is logged at WARN as "config
changes require a restart to take effect", naming the fields.[5]
Graceful shutdown
On SIGTERM or SIGINT the node stops in this order:[6]
- readiness turns false;
- handoff: writes for placed partitions are refused, writes already admitted finish, and
the node waits — up to
network.shutdown_timeout(30s) — until every copy tailing it has been sent everything it made durable; on timeout it logs an ERROR naming how many copies were behind, and goes on; - the WAL checkpoint loop stops;
- the cluster planes stop (replica supervisor, joiner, replication listener) while the data path still works;
- the data listener stops accepting and drains its connections, waiting up to
network.shutdown_timeout; - the control listener stops, then the Raft node;
- every stream's in-memory data is written to chunks;
- the metrics server stops last.
Only step 7 can fail the shutdown. TestShutdown_TheClusterPlanesStopWhileTheDataPathStillServes
pins the order of the cluster planes, and
TestServerBinary_ASigtermedPrimaryUnderLoadLosesNoAckedWrite shows a primary stopped under
load loses no acknowledged write to its copy.
Two costs are known and unchanged. A connection that is open but idle (a routing client, a
dashboard, a quiet subscriber) is waited on for the whole of network.shutdown_timeout
before it is closed, so a node with any connected client takes about that long to stop. And
step 7 writes each stream's data one stream at a time — measured at about 45 ms a stream
(1,000 streams, 45.4 s, 2026-10-20, on a developer laptop's NVMe with other work running) —
so a node holding many streams can outlast an orchestrator's grace period. Killed during it,
the node loses nothing acknowledged; recovery at the next start is slower. See
Known limitations.
Exit status
| Status | When |
|---|---|
| 0 | A clean shutdown after SIGTERM/SIGINT. |
| 0 | The node was decommissioned: its drain finished, the cluster removed it, and its registration was refused with the final answer. It logs "this node has been decommissioned and has left the cluster; shutting down" and stops through the ordinary shutdown. Restarted afterwards on its old data directory, it logs "...; not starting" and exits 0 again without serving (TestServerBinary_). |
| 0 | -. |
| 1 | Any startup failure (invalid configuration, a TLS file or keyring that will not load, a failed consensus start or admission, an unreadable WAL, a port already in use on the data or control listener), or a failure writing data to chunks during shutdown. The reason is printed to standard error as mirexa:. |
| 2 | A flag the parser does not know (the standard library's flag behaviour). |
| by signal | An unhandled signal, such as SIGKILL. Recovery replays the write-ahead log at the next start (TestCrash_). |
A clustered node never falls back to running alone: a failed consensus start or a failed join is fatal, because a node that silently ran standalone would acknowledge writes for a cluster it is not part of. See Joining, draining and decommissioning nodes.
Files it writes
Everything lives under storage.data_dir. The layout, formats and magic numbers are on
Indexes and the on-disk layout and
On-disk formats; in brief:
| Path | What |
|---|---|
streams. |
The node's stream catalog and each stream's metadata (calendar, closures, lineage, cache size). |
wal/ |
The write-ahead log: wal. (an exclusive lock, so two processes never share a directory), numbered segment files, shard_ tick logs, and quarantine.. |
partition_ |
Each partition's streams: chunk files, stream., gap., tick storage; on a copy, also its replica logs. |
quarantine/ |
Partition directories moved aside — a divergent copy, a partition this node no longer holds a role in, or one whose index was corrupt at startup. Nothing deletes them; an operator removes them. |
raft/ |
Only when clustering is on: the consensus log and snapshots. |
Outside the data directory it writes only its log, to standard error by default
(logging.output may name a file instead, rotated by logging.max_size_mb,
max_backups and max_age_days).
References
Source
- /cmd/server/main.go —
configFromFlags,buildConfig,run,awaitStop,notStartingIfDecommissioned,shutdown,watchConfig,buildTLS. - /cmd/server/replication.go — the replication listener and its SIGHUP reload.
- /internal/config/loader.go —
Load,DefaultWithEnv,applyEnv. - /internal/config/config.go —
Default, every listener's default address. - /internal/network/tls.go —
CertReloader.WatchSIGHUP. - /internal/observability/server.go —
/metrics,/health,/ready. - /Makefile, /Dockerfile — build output names.
Tests
TestLoad_Precedence— /internal/config/loader_test.go.TestDefaultWithEnv_AppliesEnv— /internal/config/loader_default_test.go.TestShutdown_TheClusterPlanesStopWhileTheDataPathStillServes— /cmd/server/drain_test.go.TestStartClusterPlanes_TheStopIsSafeToCallTwice— /cmd/server/replication_test.go.TestServerBinary_ASigtermedPrimaryUnderLoadLosesNoAckedWrite— /tests/server_binary_sigterm_test.go.TestServerBinary_ADecommissionedNodeExitsOnItsOwn— /tests/server_binary_decommission_test.go.TestCrash_KillDashNine— /tests/recovery_test.go.TestTLS_RecordsHandshakeAndReloadMetrics— /internal/network/metrics_record_test.go.
Further reading
- Running a node, Configuration reference
- Startup, shutdown and recovery
- TLS and certificates, Monitoring and alerting
- Deploying with Docker Compose
External
- Package os/signal — default behavior of signals in Go programs, The Go Authors — https://pkg.go.dev/os/signal#hdr-Default_behavior_of_signals_in_Go_programs
- Package flag, The Go Authors — https://pkg.go.dev/flag
the
buildtarget in /Makefile; theserverstage of /Dockerfile. ↩︎buildConfigin /cmd/server/main.go;LoadandDefaultWithEnvin /internal/config/loader.go. ↩︎config.Defaultin /internal/config/config.go; the shared-port check in /internal/config/validate.go;startObservabilityServerin /cmd/server/main.go overobservability.Server.Listen(/internal/observability/server.go);TestServerBinary_ANodeThatCannotBindItsObservabilityPortDoesNotStart. ↩︎catchHangupin /cmd/server/main.go, called at the start ofrun, andconfig.Watcher.Triggerin /internal/config/loader.go; the certificate reloaders subscribe to the same signal inCertReloader.WatchSIGHUP(/internal/network/tls.go), whichbuildTLScalls only when TLS is enabled, andNodeTLS.WatchSIGHUPon the replication listener (/cmd/server/replication.go). ↩︎hotReloadableandwatchConfigin /cmd/server/main.go. ↩︎shutdownand its doc comment in /cmd/server/main.go. ↩︎