High Availability
Two Meridian nodes form an active/passive pair coordinated through their shared PostgreSQL database: one node runs all services (ACTIVE), the other waits fully installed but with services stopped (STANDBY) and promotes itself if the active node fails. All liveness decisions use the database clock; node clocks never participate.
Node A [ACTIVE] Node B [STANDBY]
runs all services blocked at the startup gate
writes heartbeat ──────┐ monitors partner heartbeat ──┐
serves /rest/ha/* ▼ │
shared PostgreSQL ◄───────────────────────────┘
ha_instance_status
▲
└── /rest/ha/sync/* ────► standby pulls etc/ from active
Requirements
-
Two identically installed nodes (same version, same install path) sharing one PostgreSQL database.
-
Network access between the nodes' web ports (config sync, REST status) and from both nodes to PostgreSQL.
-
The HA feature artifacts present in the distribution (
lib/andsystem/). -
A PostgreSQL
max_connectionslarge enough for both nodes at once. During every handover the old active node is still draining while the promoted node starts its services, so both hold connections for a short time. Size it as at least twice one node’s pool total (themaxPoolof theopennms,opennms-admin, andopennms-monitordata sources inopennms-datasources.xml), plussuperuser_reserved_connectionsand any other clients of the server. Running out during a handover can crash the promoted node; PostgreSQL logs it asFATAL: sorry, too many clients already.
Install the second node
Install the second node exactly as you installed the first (see Installation and Configuration), with two differences:
-
Point its
$OPENNMS_HOME/etc/opennms-datasources.xmlat the same database as the first node: the pair coordinates through that shared database, and neither node holds HA state locally. -
Run
$OPENNMS_HOME/bin/install -disbefore the node joins the pair — ideally with the first node stopped, or during a maintenance window, since it touches the shared database. The schema is already initialized, so the run changes nothing there, but it creates theetc/configuredmarker; without itbin/opennms startrefuses to start.
Config sync replicates only $OPENNMS_HOME/etc, so anything outside it needs to be applied to the second node by hand: systemd drop-ins (for example LimitNOFILE), OS limits, kernel tuning, and Java settings in /etc/sysconfig or /etc/default.
Hand-applied tuning on the first node is easy to miss here.
A node that runs out of file descriptors logs Too many open files; network sockets count against that limit, so it can appear under connection load rather than file access.
Do not hand-copy $OPENNMS_HOME/etc from the first node: config sync populates it once HA is enabled, and the per-node files (ha-configuration.xml, plus anything in <sync-excludes>) must stay local.
Enable
On each node:
-
Activate the HA shell and REST features once:
echo "opennms-ha-rest" | sudo tee ${OPENNMS_HOME}/etc/featuresBoot.d/ha.boot echo "opennms-ha-shell" | sudo tee -a ${OPENNMS_HOME}/etc/featuresBoot.d/ha.boot -
Edit
$OPENNMS_HOME/etc/ha-configuration.xml: setenabled=true, a uniqueinstance-id, therole(one PRIMARY, one SECONDARY), the partner’sinstance-idand REST URL. Use HTTPS forpartner-rest-urlin production; sync transfers credential stores.Changes to enabled,instance-id,role,mode, orpartner-rest-urltake effect only on restart, and a running node rejects the whole reloaded file (including runtime-safe settings) while any of them differ from what it started with. A file that does not parse is ignored with a warning while the node runs, but stops the node from starting services at the next restart, so you may want to check it withxmllint --nooutafter editing. -
Enable HTTPS on each node if you follow that advice. Setting the
org.opennms.netmgt.jetty.https-*properties inopennms.properties.d/is not enough on its own: no HTTPS connector exists until you copyetc/examples/jetty.xmltoetc/jetty.xmland uncomment its "Add HTTPS support" block. See Secure Jetty with HTTPS for the full procedure. The host name inpartner-rest-urlmust match a name in the partner’s certificate; a URL with an IP address fails hostname verification unless the certificate lists that address as a SAN. -
Create the config-sync service account on the active node: add a user (see User Creation and Configuration) and assign it the
ROLE_ADMINsecurity role. The standby authenticates to the active node with this account to pull configuration; any user name works. Creating it on one node is enough, becauseusers.xmlis itself synced.If you create the account through the REST API, add
hashPassword=trueto the request (POST /rest/users?hashPassword=true, orPUT /rest/users/<id>withpassword=<password>&hashPassword=true). Without it thepasswordvalue is stored verbatim inusers.xml, and that file is then replicated to the other node. The web UI always hashes the password. -
Store that password in each node’s vault so it never appears in a configuration file:
$OPENNMS_HOME/bin/scvcli set hasync hasync <password>Then set
<sync-username>hasync</sync-username>and<sync-password>${scv:hasync:password}</sync-password>inha-configuration.xmlon both nodes. -
Using
systemctl edit, uncomment the lines forRestart=andRestartSec=in the shippedopennms.servicesystemd unit. -
Restart both nodes. The PRIMARY claims ACTIVE; the SECONDARY blocks before starting services and monitors the primary’s heartbeat.
States
| State | Meaning |
|---|---|
ACTIVE |
Runs all services; writes its heartbeat every |
STANDBY |
A SECONDARY waiting to take over: alive and heartbeating, services blocked. Promotes when the PRIMARY’s state becomes non-ACTIVE or its heartbeat exceeds |
DEGRADED |
A PRIMARY that started while the SECONDARY was serving: alive and heartbeating, services blocked, and it reclaims ACTIVE automatically as soon as the SECONDARY stops being ACTIVE. Both states mean "not serving"; they differ in which node is waiting and what it is waiting for. |
FAILED |
The node stopped while holding an active role, without a handover. Published only after its services finished stopping. |
A node that cannot load its HA configuration, prove its partner’s state, or persist its own refuses to start services rather than run unsupervised.
Operate
| Action | How |
|---|---|
Status |
|
Failover (step the active down) |
|
Failback |
Start the repaired primary (it parks DEGRADED), let one sync cycle complete, then run failover on the serving secondary. The primary reclaims ACTIVE automatically. |
Planned restart without failover |
Stop the standby first, restart the active, start the standby again. |
Change settings at runtime |
Edit the file (re-read every 60 seconds), |
Failure detection: a hard failure (power loss, kill -9) leaves the row ACTIVE with an aging heartbeat; the standby promotes after failover-threshold-seconds plus one verification interval.
A graceful stop publishes its terminal state after the service drain, and the partner promotes on it immediately.
If both nodes ever consider themselves ACTIVE (split brain), the node that took the role earlier halts itself; arbitration only counts a partner whose heartbeat is live.
Timing and tuning
Defaults are a heartbeat every 10 seconds, a failover threshold of 60 seconds, and a config sync every 60 seconds. The minimum values are a 5-second heartbeat interval, a 20-second failover threshold, and a 5-second sync interval; the threshold must also be at least twice the heartbeat interval. Values below a minimum are raised rather than rejected, and the change is logged: a 60-second heartbeat forces the threshold to at least 120 seconds, whatever you configured.
Approximate handover times with the default settings:
| Event | The standby begins starting services after |
|---|---|
Operator failover, or a graceful stop of the active node |
the active node’s service drain completes, plus up to one heartbeat interval |
Hard failure (power loss, |
the failover threshold plus one verification interval — about 70 seconds |
The promoted node then needs its normal service startup time before it is fully serving. Both nodes need a database round-trip well inside the heartbeat interval; node clock skew is irrelevant, since every timing decision uses the database clock.
Configuration sync
While non-ACTIVE, a node replicates etc/ from the active node every sync-interval-seconds: binary-safe (keystores, users.xml, scv.jce), hash-compared, applied atomically, with deletions propagated.
ha-configuration.xml and examples/ are never synced.
On identically installed nodes leave <sync-excludes> empty; list only files that genuinely differ per node (for example a host-specific certificate store).
A file excluded on either node is neither overwritten nor deleted by sync.
Client access
A non-ACTIVE node does not listen on its web port at all, because HA holds startup before the web server starts.
An unauthenticated HTTP health check against the web port, such as GET /opennms/rest/health/probe, therefore tells a load balancer or reverse proxy which node is serving.
The probe returns 200 only when all health checks pass (599 otherwise), so a failing check also takes the active node out of rotation; GET /opennms/login.jsp checks only that the web server is up.
Supervision modes
<mode>coordinator</mode> (default) — the node runs the HA state machine described above itself.
<mode>heartbeat-only</mode> — an external supervisor (HA agent, cluster manager) owns all decisions and the node’s only HA duty is publishing its heartbeat; startup is never gated and config sync is not run.
Use this when a third-party tool manages failover.
Security notes
The /rest/ha/config, /rest/ha/failover, and /rest/ha/sync/* endpoints require ROLE_ADMIN; the sync endpoints serve raw credential stores.
Because sync replicates keystores and users.xml, the two nodes form a single secret domain: protect etc/ and the sync account credential accordingly, and prefer HTTPS between the nodes.