OPNexusdocs

Several backends on one database

The background services (reverting unconfirmed changes, notifications, log fetching, measurements, scheduled maintenance and rollouts, security posture, audit export, scheduled backups, rule history) always run in only one backend process, the leader. It holds a lock in the database for this. A second backend on the same database (for example during a migration or later as a reserve) answers the API normally but waits with the background services in standby. If the leader fails or loses its connection to the database, it stops its services immediately; a waiting backend takes over within half a minute. On a database that is currently a replica, a leader never starts.

Which role a backend has is shown by GET /api/health ("role": "leader", "standby", "takeover", "replica") and the metric opnexus_leader. For a single installation nothing changes: its only backend is the leader; the background services start after boot with a delay of about 12 seconds.