Mirexa

Wiki Operations

Running a node

Starting mirexa-server for the first time — the data directory, the ports it opens, environment overrides, health and readiness, and a minimal configuration.

A Mirexa node is one process, mirexa-server, that owns one data directory and serves the binary wire protocol to clients. Without any configuration beyond a data directory it runs as a single node with TLS off and authentication on, issuing its own tokens, which suits a laptop and little else. This page covers first start, what the node opens and writes, how to check it is healthy, and a minimal configuration to start from.

First start

bash
mirexa-server -data-dir ./data

The two flags are the whole command line:

Flag Meaning
-config <file> YAML configuration file. Optional.
-data-dir <dir> data directory; overrides storage.data_dir

Without -config, the node runs on the built-in defaults plus any MIREXA_* environment variables. With -config, the file must itself name storage.data_dir (or the environment must, through MIREXA_STORAGE_DATA_DIR): the file is validated before -data-dir is applied, so a file without a data directory is refused even if the flag is given.

With no security.auth.trusted_keys configured, the node first provisions its own token issuer and says where it put the admin token:

json
{"level":"info","msg":"auth: no trusted_keys configured, so this node issues its own tokens","admin_token":"/var/lib/mirexa/auth/admin.token","issuer_key":"/var/lib/mirexa/auth/issuer.key"}

That token carries every permission; point clients at the file (-token-file on mirexa-cli, a TokenSource in Go, token_file in Python), since the node rewrites it every 20 minutes. See a single node issues its own tokens.

On success the node logs one summary line (JSON, to stderr by default):

json
{"level":"info","msg":"mirexa started","data_dir":"/var/lib/mirexa","compression":"fixed_point_dod","listen":"[::]:8080","tls":false,"auth":true,"auth_trusted_keys":["local"],"max_permissions":[],"observability":":9090","control":"disabled","raft":"disabled","known_streams":0}

It states the security posture explicitly: tls, auth, the trusted issuer names (local is the node's own), and the grant ceiling (an empty max_permissions means no ceiling). A node that logs "auth":false accepts any client and trusts the permissions the client asserts — see authentication.

The node stops on SIGINT or SIGTERM, draining its hot caches to disk first. SIGHUP reloads the TLS certificate (when TLS is on) and does not stop the node. See startup, shutdown and recovery.

The data directory

Everything the node persists lives under storage.data_dir; there are no other path settings. The node creates the directory if it is missing. Its main contents:

Path What it is
auth/ the node's own token issuer (issuer.key, issuer.pub) and admin.token; only when auth is on with no trusted_keys
streams.meta the node's stream registry: every stream it holds and its metadata (calendar, lineage, cache size)
wal/ the write-ahead log: *.log segments for candles, shard_<n>/ for ticks, and wal.lock
partition_<n>/<stream>/ per-stream stream.idx, gap.idx, chunks/ and ticks/
raft/ consensus state; only on a clustered node
quarantine/ partitions set aside rather than deleted; never cleaned automatically

The full layout and file formats are in indexes and the on-disk layout and on-disk formats.

  • One process per directory. The WAL holds an exclusive flock on wal/wal.lock; a second node pointed at the same directory fails at startup.
  • Back it with local disk and keep free space. The WAL grows between checkpoints (wal.checkpoint_interval, 15 minutes by default) and recovery reads it at startup. See disk space.
  • Do not change partition.count for a directory that holds data: streams are placed in partitions by hashing modulo the count, and a different count looks in the wrong directories.

Ports

Listener Config key Default Protocol Opened when
Data plane network.addr :8080 (all interfaces) Mirexa wire protocol over TCP, optionally TLS always
Observability observability.addr :9090 (all interfaces) HTTP: /metrics, /health, /ready always
Control control.addr 127.0.0.1:9090 gRPC, optionally TLS control.enabled: true
Raft cluster.raft_addr (none) hashicorp/raft TCP transport cluster.enabled: true
Replication cluster.replication_addr (none) gRPC over mutual TLS clustered and set

The observability and control defaults share port 9090. If you enable the control listener, change one of the two addresses. With both on 9090 the control listener wins, the observability server logs address already in use once at ERROR, and the node runs on with no /metrics, /health or /ready (reproduced 2026-10-30).

The data-plane default binds every interface. Anything that can reach it and holds a token can read and, unless restricted, write data, and without TLS a token crosses the network in plaintext, replayable until it expires. For anything but local experimentation, bind it to a private address or turn on TLS, and give clients tokens narrower than the admin token (authentication). The control listener has no authentication of its own unless control.admin_auth is on; keep it on loopback. On a single node nothing stops you from binding it to a routable address without authentication — that serves the stream-metadata API to anyone who can reach it.

Environment overrides

Most node-local keys can be set from the environment as MIREXA_<SECTION>_<KEY>, applied over the file:

bash
MIREXA_STORAGE_DATA_DIR=/var/lib/mirexa \
MIREXA_NETWORK_ADDR=10.0.0.5:8080 \
MIREXA_OBSERVABILITY_ADDR=127.0.0.1:9091 \
MIREXA_LOGGING_LEVEL=debug \
mirexa-server

A value that does not parse is reported as [config warning] ... on stderr and ignored — it does not stop the node. Not every key has an override: nothing under security.auth, control, cluster, query_cache or dashboard does, nor security.max_permissions, storage.decoded_chunk_cache_bytes, wal.checkpoint_interval and a few others. The configuration reference marks each key.

Health and readiness

The observability server answers three paths:

Path Answers 200 when 503 when
/health liveness every registered check passes any check fails
/ready readiness the node has finished starting and every check passes still starting, shutting down, or a check fails
/metrics Prometheus text exposition always —

Two checks are registered: tcp_listener (the data-plane listener is running) and data_dir (the data directory exists and is a directory). The data_dir check does not look at free space. Readiness becomes true only after the data plane, control plane and cluster planes are up and the observability server itself has started; it turns false as the first step of shutdown, before the node stops accepting connections.

bash
curl -s localhost:9090/ready
json
{"ready":true,"started":"2026-10-30T10:00:00Z","checks":[{"name":"tcp_listener","status":"healthy"},{"name":"data_dir","status":"healthy"}]}

/health returns the same checks with status (healthy or unhealthy) and uptime. Nothing answers on the observability port until late in startup (after WAL recovery and, on a clustered node, after joining), so a long recovery looks like a refused connection, not a 503. Give orchestrator probes a generous initial delay.

On a clustered node, /ready says only that the process is serving its listeners. It does not say the node holds a lease or any partition; use the cluster metrics and the control API for that (operating a cluster).

A minimal configuration

A single node reachable on a private network, with authentication on and metrics on loopback:

yaml
storage:
  data_dir: /var/lib/mirexa

network:
  addr: 10.0.0.5:8080

observability:
  addr: 127.0.0.1:9090

security:
  auth:
    enabled: true
    trusted_keys:
      - name: ops
        public_key: "BASE64-FROM-mirexa-cli-token-keygen"

# Optional: the control listener for stream calendars and status.
control:
  enabled: true
  addr: 127.0.0.1:9091
bash
mirexa-server -config /etc/mirexa/node.yaml

Clients then need a token: see authentication for minting one, and the quickstart for a first write and read. A clustered node needs the cluster: section described in operating a cluster.

What the defaults give you

Setting Default Consequence
security.auth.enabled true a client needs a signed token; with no trusted_keys the node generates its own issuer and writes an admin token to <data_dir>/auth/admin.token
security.tls_enabled false traffic, including tokens, is in plaintext
wal.sync_policy always every acknowledged write is fsynced to the WAL first
wal.checkpoint_interval 15m the WAL is trimmed every 15 minutes
storage.compaction_entry_threshold 50000 retention is on: past 50,000 chunks a stream's oldest half is deleted (roughly 260–520 days of a live stream; see configuration)
query_cache.enabled false no query-result cache
control.enabled false stream calendars cannot be set until it is on
cluster.enabled false single node

References

Source

Tests

Further reading