Run a highly-available deployment
By default the LinkMesh server runs as a single instance. Even if that instance is down, your collectors keep running and your telemetry keeps flowing, because telemetry never travels through the server. What you lose while it is down is the control plane: the UI, the API, config push, and fleet status.
A highly-available (HA) deployment runs several server instances behind a load balancer, so that losing one node doesn’t take the control plane with it. The instances are interchangeable: they share one configuration history, a change saved through any of them reaches every collector, and background jobs run once per deployment, not once per instance. HA is supported from LinkMesh server 1.470.6.
What the lab measured
Section titled “What the lab measured”We ran three server instances on Kubernetes from the Helm chart’s
values-ha.yaml, sharing a three-member MongoDB replica set, behind an
NGINX ingress load balancer, with five collectors (four node DaemonSet
pods and one cluster collector) exporting every 5 seconds to a
destination that counted each data point it received. Each scenario took
one instance away. These are measurements from that lab, not guarantees
for your environment.
| What happened to the instance | Collectors on another instance after | Telemetry at the destination | A config change saved meanwhile |
|---|---|---|---|
| Deleted (graceful shutdown) | under 1 second | no gap beyond one scrape interval | accepted, delivered |
| Process killed (crash) | under 1 second | no gap beyond one scrape interval | accepted, delivered |
| Node drained (PodDisruptionBudget in place) | 1–5 seconds | no gap beyond one scrape interval | accepted, delivered |
| Process hung (not answering, not exiting) | about 60 seconds, when the liveness probe restarted it | no gap beyond one scrape interval | accepted, delivered |
| Cut off from the load balancer but still running | 75–90 seconds, when the load balancer’s read timeout closed the connections | no gap beyond one scrape interval | accepted through another instance, delivered when the collector reconnected |
| MongoDB primary stepped down | not affected; a new primary in about 7 seconds | no gap beyond one scrape interval | accepted, delivered |
No config write was refused in any scenario, and no collector came back with a different configuration than it left with.
Across the instances, in the same lab:
- A config change saved through any instance reached every affected collector within 4 seconds, including collectors connected to the other instances.
- A replaced instance (upgrade, node drain, deleted pod) takes the configuration from the shared history at boot and is ready on its own.
- Background jobs (alert evaluation, status checks, clean-up sweeps) ran once per deployment over a one-hour soak, also after all three instances were killed at the same moment.
- A revoked permission was refused on every instance within about 5 seconds; a deleted user at once. An account locks after 10 wrong passwords in total, through the load balancer as on one instance.
- The collector licence cap holds across instances: two instances enrolling at the same moment admit only one collector against the last free seat. An uploaded licence is in force on every instance and survives a restart.
A collector command (Restart) sent through any instance reaches the
collector whichever instance it is connected to, usually within a
second, and is delivered once. A command for a collector that no
instance holds is answered 409 as on a single server, after about
3 seconds while the other instances are asked, and is not delivered
later when the collector reconnects.
A live capture can be started, followed and stopped through any
instance, whichever instances the collector and its agent are connected
to. A start through another instance takes up to about 2 seconds longer
than on a single server. If no instance holds the collector, the start
is refused with 503 (“collector offline”), and without its agent with
409 (capture_requires_agent), as on a single server. A refused or
abandoned start leaves nothing running on the collector.
Limits to plan for
Section titled “Limits to plan for”- A hung or cut-off instance keeps its collectors for a while. Its collectors move once the liveness probe restarts it (about a minute) or the load balancer’s read timeout closes their connections (which is why that timeout must be short; see step 4 below). Their telemetry keeps flowing meanwhile; only their status and config delivery wait.
- Every instance runs the same version. An HA install is upgraded stop-the-world, with a control-plane gap of a few seconds; see Upgrading an HA install.
- Each instance needs the same secrets key. Set the same
LINKMESH_SECRETS_KEYon every instance. Without it, each instance generates its own key and can’t read secrets another instance stored — see Destination secrets. The Helm chart refuses to install several instances untilsecretsKey.existingSecretnames a Secret holding the key. An instance whose key can’t open the stored secrets refuses to store new ones (503) and reportssecretsVault: key-mismatchon/health.
The target topology
Section titled “The target topology”flowchart TB
LB[Load balancer]
subgraph Servers["LinkMesh server instances"]
S1[Instance 1]
S2[Instance 2]
S3[Instance 3]
end
Mongo[(MongoDB replica set<br/>shared fleet state)]
LB --> S1 & S2 & S3
S1 & S2 & S3 --> Mongo
The pieces an HA deployment is built from:
- Several server instances, all on the same LinkMesh server version. The server enforces this: an instance of another version does not start serving next to them.
- A load balancer in front of them. It fronts the single HTTP port that serves the web UI, the API, and the collector control channel.
- A shared MongoDB database, run as a replica set, holding the fleet state every instance reads and writes.
What the topology requires
Section titled “What the topology requires”-
Switch to the MongoDB storage backend. BoltDB is a local file and can’t be shared between instances, so it can’t back a multi-instance deployment — MongoDB is mandatory. See Storage backends for the comparison and Deploy with MongoDB for setup.
-
Use a MongoDB replica set. The server relies on database transactions for its multi-document writes; MongoDB only offers transactions on a replica set. Three members is the usual production minimum.
-
Point every instance at the same database. All instances must share one MongoDB connection target.
-
Put a load balancer in front. Plain HTTP load balancing works for the web UI and REST API. The collector control channel (an OpAMP WebSocket) sits on the same port behind it — see Run behind a reverse proxy for the proxy and TLS specifics (WebSocket upgrade headers matter).
Set the load balancer’s read timeout to 90 seconds or less. When an instance can no longer be reached from the load balancer but is still running, this timeout is the only thing that closes its collectors’ connections so they reconnect to another instance. A live, idle connection never trips it: the server writes to every collector and browser connection at least every 30 seconds. On ingress-nginx that is
nginx.ingress.kubernetes.io/proxy-read-timeout: "90"andproxy-send-timeout: "90"(the chart’svalues-ha.yamlsets both); on NGINXproxy_read_timeout 90s;, on HAProxytimeout server 90s, on an AWS ALB an idle timeout of 90 seconds. Don’t copy the one-hour WebSocket timeout often used for a single server. -
Send traffic only to ready instances. Point the load balancer’s health check (or the Kubernetes readiness probe) at
/ready, not at/health./healthonly says the process is alive;/readyanswers503with the reason while an instance is starting, waiting for another instance to finish a data migration, waiting for an instance of another version to stop, or missing its configuration repository. The Helm chart does this for you.
On Kubernetes, install the Helm chart with its values-ha.yaml. It runs
three instances on MongoDB with a temporary volume each, requires the
shared secrets key, uses /ready for readiness, and sets the load
balancer timeout for ingress-nginx. There is nothing else to configure:
the instances share the configuration history, config pushes and
background jobs through MongoDB, so no Git server, no extra port and no
extra Service are needed.
What already holds across instances
Section titled “What already holds across instances”These hold whether you run one instance or several:
- Fleet state in MongoDB is consistent. The collector list, status, licence seats, users, the list of roles, pipeline versions and stored secrets read the same on every instance within about a second. Deleting a user takes effect on every instance at once.
- Permission changes reach every instance within about 5 seconds. A role, group membership or scoped access saved through one instance is enforced on the others within about 5 seconds; a revoked permission stops working everywhere within that time.
- Enrollment is safe across instances. A single-use enrollment token used by two hosts at the same moment enrols only one of them, and the collector licence cap holds when two instances enrol at once.
- Multi-document writes — token rotation, collector deregistration cascades, enrollment, and similar — are wrapped in database transactions, so they commit atomically or not at all.
- Read-modify-write paths — editing a user, saving the routing
canvas — use optimistic concurrency. If two requests race the same
record, one wins and the other gets a
409 Conflictto retry, rather than silently overwriting. - MongoDB primary failover is handled by the database driver, which
discovers the new primary within a few seconds and reconnects (about
6 seconds in the lab, with no failed request). In-flight writes follow
MongoDB’s write-concern and retryable-write semantics; the default
w: majoritywith retryable writes gives you “the write committed, or you got an error you can safely retry.” - Only one instance runs data migrations. When a new version starts, one instance migrates the database while the others wait, not ready, until it is done.
Upgrading an HA install
Section titled “Upgrading an HA install”An HA install is upgraded stop-the-world: every instance stops, the new version starts, one instance migrates the database, and the rest follow. Two versions never serve one database at the same time. The full procedure, including what you see if an instance of another version is still running and how to roll back, is in Upgrade LinkMesh → Upgrading a multi-instance (HA) install.
In the lab the upgrade’s control-plane gap was 3 seconds from the last old instance stopping to the first new one being ready, and about 10 seconds of failed requests through the load balancer. Collectors kept sending telemetry throughout and reconnected on their own.
The configuration history lives in MongoDB, so there is nothing to save or restore around the upgrade: every new instance takes it from there.
Can I run two LinkMesh server versions at the same time?
Section titled “Can I run two LinkMesh server versions at the same time?”No. Two server versions never serve from one database, and the
server refuses it. An instance that starts while an instance of a
different version is still running stays not ready, does not touch
the database, and says why — in its log, on /ready, and in a banner in
the UI (“Two LinkMesh Server versions are registered on this store”). The
instances already serving keep running and only warn. A rolling update
therefore stalls with the old version still serving, rather than mixing
versions.
We tested what mixing does when nothing stops it: with one of four instances on a newer version, the UI failed to load in 22 of 24 browser sessions, the licence cap was exceeded, and the older version undid data the newer one had written. None of it showed up in any log. Upgrade every instance at once instead — see Upgrading an HA install.
Ready-to-use collector configs
Section titled “Ready-to-use collector configs”Complete OpenTelemetry Collector configs for the same jobs, validated against the collector and with the mistake that usually breaks each one:
- Agents to a gateway tier, load-balanced by trace ID
- Buffer through a backend outage with a persistent queue
Related
Section titled “Related”- Upgrade LinkMesh — the upgrade procedure, including multi-instance installs and rollback
- System requirements & sizing — sizing the single instance, and the deployment shapes
- Storage backends — BoltDB versus MongoDB
- Deploy with MongoDB — replica-set setup, sizing, and backups
- Run behind a reverse proxy — fronting the web UI, API, and collector control channel on one port
- Configuration reference — the
storage.*anddatabase.*keys each instance needs