Why replicated PostgreSQL is the foundation of a Central Server cluster
If you run or plan several X-Road Central Server nodes on a shared database, the database is the single point that decides whether the cluster survives a failure. The nodes can each be healthy, but if the PostgreSQL primary goes down and no standby can take over, the configuration store is unavailable to every node at once. Replicated PostgreSQL, meaning a primary with at least one hot standby kept current by streaming replication, is the foundation that removes that dependency. Your Central Server cluster is only as available as the database beneath it, so plan the database as a first-class component rather than an afterthought to the Central Server install.
The Security Server requires PostgreSQL, either local or remote, and the same database dependency applies to the Central Server design in this group. PostgreSQL supports hot standby servers that serve read-only queries, and it supports two replication modes. With synchronous replication, a commit waits until standbys confirm it, which protects committed configuration changes at the cost of write latency and of writes stalling if the standby is unreachable. With asynchronous replication, the primary does not wait, which keeps writes fast but means a failover can lose the most recent commits. Choosing between these two modes is the first decision to record and have signed off by your operations and risk owners.
PostgreSQL does not detect a failed primary or promote a standby on its own. Automatic failover therefore needs an external tool or a managed service feature, and each option has its own fencing, split-brain and monitoring trade-offs that you must test. A single local database or a managed instance such as AWS RDS or Azure Database for PostgreSQL may be enough if your recovery objectives accept a restore or a manual promotion, and if the provider's own availability design meets your requirement; confirm the provider's failover behavior in writing. It is not enough when the cluster must keep accepting configuration changes through a single node failure without manual intervention. Confirm your recovery time and data-loss targets before you pick a topology.
How Central Server nodes, the primary database and the standby fit together
The diagram starts with the Central Server nodes in the X-Road network, which connect over TLS to the primary PostgreSQL in the database network. The primary streams changes to a standby, and the standby can be promoted either by an external failover tool or by an operator. The subgraph boundary marks where the X-Road network ends and the database network begins, so check that every crossing is encrypted and that each promotion path has a named owner and a tested runbook before go-live.
Central Server nodes reach the primary over TLS, which streams changes to a standby.
Which failover approach fits your operating model
With manual promotion, your operator decides that the primary is lost, promotes the standby and repoints the Central Server nodes. PostgreSQL provides the promotion step, but it does not detect a primary failure or notify the standby, so detection and the decision to promote rest entirely with people on call. This model keeps control of every change to the configuration database and avoids the risk of a tool promoting a standby during a network partition.
- Detection: monitoring must alert the on-call team quickly, and the runbook must define what counts as a failed primary.
- Promotion: the operator promotes the standby and confirms it accepts writes before any Central Server node is restarted.
- Fencing: the old primary must be stopped or isolated so it cannot accept writes after promotion.
- Recovery time: it depends on staffing and hours, so test the runbook under realistic conditions.
- Replication mode: asynchronous replication may lose the last committed transactions on promotion, and this must be accepted in writing.
Before you choose this model, confirm with your Central Server operating procedures how long the cluster can run on one database and who is authorized to promote.",
External automatic failover adds a tool, separate from PostgreSQL, that watches the primary, decides when to promote a standby and handles client redirection. PostgreSQL's documentation states that the server does not provide the software to detect failure and notify the standby, so this tooling is a separate component that your team must select, install, configure and operate. The tool becomes part of your availability design and needs its own monitoring, upgrades and failure testing.
- Selection: evaluate candidate tools against your own TLS, authentication and audit requirements, because the choice is yours.
- Detection: the tool owns failure detection, so tune timeouts to avoid promoting on brief network interruptions.
- Split-brain protection: confirm how the tool fences the old primary and what happens during a network partition.
- Operations: the tool needs its own high availability, certificates and upgrades.
- Replication mode: synchronous replication reduces data loss on promotion but makes commits wait for standbys, which affects Central Server latency.
Confirm the tool's behavior with its vendor or project documentation, and test failover in a non-production cluster before relying on it.",
A managed PostgreSQL service moves part of the failover work to the cloud provider, which runs the standby, monitors health and performs promotion under its own service terms. The Security Server documentation lists managed services such as AWS RDS and Azure Database for PostgreSQL as supported remote databases, but that support statement covers the Security Server database and does not by itself confirm how a Central Server cluster behaves during provider failover. Your responsibilities shift to configuration, network access and verification of the provider's behavior.
- Detection and promotion: the provider owns them, so ask for documented failover times and how they are triggered.
- Replication mode: ask whether the service uses synchronous or asynchronous replication across zones and whether this is configurable.
- Connection behavior: confirm whether the endpoint changes after failover and how Central Server nodes reconnect.
- Recovery and backups: confirm point-in-time recovery options and retention.
- Cost: the service fee recurs and rises with instance size and standby count, so request a quote that separates these items.
Confirm all of this in writing with the provider, and check that the database meets the Central Server requirements for version, TLS and access control.",
The three approaches differ mainly in who carries detection and promotion, and in how much control your team keeps over the database during an incident. Manual promotion gives full control but depends on response time. External tooling automates the response but adds a component you must select and operate. A managed service shifts operation to the provider but moves some decisions into service terms you must review. Your choice should follow your operating model, the staffing available outside business hours and your data loss tolerance.
- Data loss tolerance: asynchronous replication may lose recent commits on promotion, while synchronous replication makes commits wait for the standby.
- Staffing: manual promotion needs a reliable on-call rotation and a tested runbook.
- Ownership: tooling and managed services both require documented responsibility for upgrades and incidents.
- Compliance evidence: each model produces different records of who promoted the database and when.
- Testing: every model needs a rehearsed failover before go-live.
Before you decide, document the approach, the owner of each step and the failover test results in your Central Server runbook.
Replication options and when each one fits
This table compares the main configuration choices for the PostgreSQL database behind a Central Server cluster, including replication mode, standby count and placement, managed versus self-run service, and pooling. Read each row as a trade-off: what it protects against, what it costs in data safety or effort, and the conditions under which it is a sound choice.
| Option | What it protects against | Cost of the choice | When it fits |
|---|---|---|---|
| Asynchronous replication | Loss of the primary host or its storage, with a standby that keeps up in the background | A commit can be acknowledged before the standby has it, so recent configuration changes may be lost on failover | Configuration changes are infrequent and the team can re-enter a short window of edits if a failover occurs |
| Synchronous replication | Loss of the primary without losing acknowledged commits, as a commit waits for standbys | Each commit waits on standby acknowledgment, adding latency to every configuration write and making a standby outage visible to writers | Losing an acknowledged global configuration change is unacceptable and the network between nodes is low latency |
| One standby | A single replica that can take over if the primary fails | One more database server to patch, monitor and back up; failover still needs an external tool | Small operator teams that need a warm copy and can run failover tooling reliably |
| Two or more standbys | Continued redundancy after one replica is lost or taken down for maintenance | More hosts, more replication traffic and more failover logic to test; synchronous setups need careful standby selection | Operators who must keep a standby available during routine maintenance or planned upgrades |
| Standby in the same site | Host, disk or process failure with minimal network delay between primary and standby | Does not protect against loss of the whole site or data center | Node-level failures are the main risk and the Central Server nodes already share a site |
| Standby in a separate site or zone | Loss of a facility, power or network segment that takes down the primary site | Higher replication latency, more network paths to secure and more complex failover runbooks | Continuity requirements cover site loss and the organization can run and rehearse cross-site failover |
| Self-run PostgreSQL | Full control over replication settings, TLS, file layout and PgBouncer placement | Your team owns patching, failover tooling, backups and point-in-time recovery testing | Your platform team already runs PostgreSQL and can operate the failover tool and its runbooks |
| Managed PostgreSQL service (for example AWS RDS or Azure Database for PostgreSQL) | Host maintenance and some availability tasks handled by the provider, as the Security Server guide lists these services as supported options | Replication internals, parameter control and some failover behavior are set by the provider; confirm them against the service documentation before choosing | Your organization already standardizes on the provider and needs to confirm that its replication and TLS settings meet your Central Server design |
| PgBouncer connection pooling | Connection exhaustion when several Central Server nodes open many database sessions | One more component to configure, monitor and make highly available, plus pooling-mode limits to check against the Central Server's session needs | Several nodes or services connect to the database and the connection count approaches the server limit |
How to set up streaming replication for the Central Server database
This sequence takes a Central Server database from a single PostgreSQL instance to a primary and standby pair that all Central Server nodes can reach over TLS, with replication lag, connectivity and a controlled promotion verified before the cluster relies on it.
Confirm the supported PostgreSQL major version
Before installing anything, check the PostgreSQL versioning policy to confirm the major version you plan to run is still within its support window on the date you go live, and confirm that version is accepted by the X-Road release you run. Your team or DeployOpen records the chosen version, the end-of-support date and the minor release you will start from. Done when the version choice is written into the design record with its end-of-support date, so the upgrade plan can be scheduled against it.
Prepare the primary and the standby hosts
The operator, usually the infrastructure team with DeployOpen, installs the same PostgreSQL major and minor release on two separate hosts, sets matching locale and time settings, and gives each host fixed addresses and DNS names that the Central Server nodes will use. Storage, memory and network sizing follow your load estimates and the PostgreSQL documentation. Done when both hosts run the same binaries, the primary accepts local connections and the standby host can reach the primary's port.
Configure streaming replication and hot standby
On the primary, the database administrator sets the replication parameters described in the PostgreSQL high availability documentation, creates a dedicated replication role with a strong password, and allows that role in the host-based access file for the standby address only. The standby is then initialized from a base backup of the primary and started in standby mode with hot standby enabled so it serves read-only queries. Done when the standby reports it is streaming from the primary and a test write on the primary appears on the standby.
Enable TLS between nodes and the database
The administrator enables TLS on the primary and the standby using server certificates issued by your internal certificate authority, and requires encrypted connections for the replication role and for Central Server application roles in the host-based access file. Certificate subject names must match the DNS names the Central Server nodes use. Done when a connection attempt without TLS is rejected and a connection with TLS from each Central Server node succeeds, which you confirm by checking the SSL status of each session.
Point each Central Server node at the database
Each Central Server node is configured with the database connection details for the primary, plus the procedure your X-Road version documents for handling a standby, and with the TLS settings that match the certificates from the previous step. Connection credentials are stored according to your secrets policy, not in shared plain-text files. Done when every node opens its database connections over TLS and the Central Server reports a healthy database state on each node.
Verify replication lag and connectivity
Run the replication status views on the primary to read the sent, written, flushed and replayed positions for the standby, and compare them with the primary's current write position under a representative write load. Confirm that each Central Server node can reach both hosts and that a failed connection to the primary is logged. Record the lag figures as the baseline for monitoring. Done when lag returns to near zero after the load test and the baseline is stored with your monitoring configuration.
Test a controlled promotion of the standby
In a maintenance window, the administrator stops writes, confirms the standby is caught up, promotes it using the documented promotion procedure, and then points the Central Server nodes at the new primary. The PostgreSQL failover documentation states that the software does not detect a failed primary or notify the standby, so this test proves the manual steps and the node reconfiguration work. Done when the promoted database accepts writes, the nodes reconnect, and the former primary is rebuilt as a standby or set aside according to a written runbook.
How to secure connections between nodes and the database
Securing the connections between each Central Server node and the PostgreSQL cluster means encrypting every session with TLS and choosing an authentication method that the X-Road Central Server installation accepts. Both decisions apply to the primary, the standby and any pooler in front of them, so they should be planned together. Start by confirming with the X-Road documentation which PostgreSQL connection settings and authentication methods the Central Server supports in your release, because the list of options PostgreSQL offers is broader than what a given X-Road installation is built to use.
PostgreSQL supports several client authentication methods, including password, GSSAPI, SSPI, LDAP, RADIUS, certificate, PAM and OAuth. Password authentication is the simplest to operate, but it places a shared secret on every node and in every configuration file. Certificate authentication removes the shared secret but adds certificate issuance, renewal and revocation to your operations. LDAP, PAM and OAuth can centralize database logins with your identity systems, but each adds a dependency that must stay available for the cluster to reconnect after a failover. Record the method you choose, the node that owns each credential and how a rotated secret reaches every Central Server node.
Whatever method you select, use SCRAM-SHA-256 for password logins and retire MD5. PostgreSQL 18 deprecated MD5 password authentication in favor of SCRAM, and the password_encryption setting controls how new passwords are stored. Check existing roles after any upgrade, because a password stored under MD5 will not become SCRAM until it is set again. On the server side, enforce TLS in pg_hba.conf with hostssl entries only, set ssl = on in postgresql.conf, and restrict the allowed source addresses to the Central Server nodes. Verify each connection with pg_stat_ssl and test that a connection without TLS is rejected before the cluster goes live.
Security and operational considerations for the database tier
The database tier holds the Central Server configuration, so its credentials, network exposure, backups and patch cadence matter as much as the replication itself. The cards below cover the controls to decide and verify before the cluster goes into service and the routines that keep it safe afterward.
Database credentials and their storage
Each Central Server node connects to PostgreSQL with a role of its own, so a compromised node can be revoked without rotating every credential. Decide where the passwords live (a secrets manager, a root-readable file with tight permissions, or an identity-backed method) and confirm that no credential ends up in shell history, configuration templates or backup archives. Use SCRAM password authentication, since MD5 is deprecated in PostgreSQL 18. Ask the vendor or your own team to confirm how the Central Server reads its database settings before choosing a storage location.
PostgreSQL auth methodsTLS certificate lifecycle
Traffic between Central Server nodes, the standby and the database should be encrypted, which means the server certificate, its private key and the client trust chain all need owners and renewal dates. Record the expiry of each certificate in your monitoring system, and test a renewal on the standby before the primary's certificate lapses. A certificate issued from an internal CA also needs its revocation path documented. Confirm with your PKI team how certificates are reloaded without a full restart.
Network restriction of database ports
Limit the PostgreSQL listening port to the addresses of the Central Server nodes, the standby and your administration hosts, and block it from every other network segment. Replication connections should come only from the standby's address, with a matching entry in the host-based access file. Review the rules after each change to the node addresses, because a cluster that adds or replaces a node often forgets to update the database allow list.
Backups and point-in-time recovery
Streaming replication copies mistakes as quickly as data, so a deleted table on the primary reaches the standby within moments. Continuous archiving of WAL files to a separate location, combined with periodic base backups, allows recovery to a chosen point in time. Store the archive outside the database hosts, encrypt it, and restore it to a scratch system on a schedule to prove it works. Ask for the recovery time and data loss you can accept, then test against them.
Continuous archiving docsAccess to standby read queries
A hot standby can serve read-only queries, which is useful for reporting but also a second route into the configuration data. Decide whether any application or analyst needs that access at all, and if so, give it a read-only role limited to the tables it needs. Keep administrative roles off the standby's client path, and log connections to it separately so reads of configuration data are visible. Confirm with your Central Server operator whether any reporting process touches the database during normal operation.
Minor release patching path
Minor PostgreSQL releases do not change the internal storage format, so patching means replacing the executables and restarting the service, with no data conversion. Apply the patch to the standby first, confirm replication resumes, then promote or switch over and patch the former primary. Keep the supported major version in view, because PostgreSQL 14 is supported only until November 12, 2026. Major upgrades need a separate plan using pg_upgrade or logical replication.
PostgreSQL versioning policyChoosing a PostgreSQL version that stays supported
Start by choosing a PostgreSQL major version that is still inside its support window for the whole life of the cluster. PostgreSQL 18 was first released on September 25, 2025 and is supported until November 14, 2030. PostgreSQL 17 is supported until November 8, 2029, PostgreSQL 16 until November 9, 2028, PostgreSQL 15 until November 11, 2027 and PostgreSQL 14 until November 12, 2026. Versions 13 and earlier are no longer supported. A new major version arrives about once a year, so a database chosen today will need a major upgrade well before its end date. Plan that upgrade as a recurring task, not an emergency.
Minor releases are different. They come at least once every three months, never change the internal storage format, and are applied by replacing the executables and restarting the server. On the standby and the primary, apply them in a planned order so the cluster keeps a usable node throughout. For a major upgrade, the documented options are a dump and restore with pg_dumpall, pg_upgrade, or logical replication. Logical replication works across major versions and can limit downtime to several seconds, but it needs careful verification of replicated objects and sequences before cutover. Choose the path by database size and the downtime your Central Server operators accept.
Before any PostgreSQL upgrade, check the X-Road release support matrix. The database version you move to must be one that the X-Road release running on your Central Server nodes supports, and that release must itself be on a supported line (currently 7.8.3, 7.7.4 or 7.6.5). Confirm this on the X-Road releases page and with NIIS documentation for your release before you schedule the change. Treat the database upgrade and any X-Road upgrade as separate change windows so that a failure can be traced to one component.
Questions buyers ask before replicating the Central Server database
How much effort and cost does replicating the Central Server database add?
Replication adds a second database node, its network and storage, monitoring, backup handling and a failover procedure, so the cost is mostly people time plus the infrastructure you already pay for. The main cost drivers are the number of database nodes, whether you run them on virtual machines, bare metal or a managed service, how many environments need the same setup (test, staging and production), and how much failover automation you add. The cost is largely one-time for the build and recurring for monitoring, patching and failover drills. Ask any partner for a quote that separates design, build, testing, documentation and ongoing support, and state the database platform and number of environments in the written scope.
How long does setting up a replicated PostgreSQL standby take?
Duration depends on the environment more than on the replication commands themselves. The work covers choosing the PostgreSQL version, provisioning and hardening the standby host, configuring streaming replication, enabling TLS between nodes and the database, testing a switchover and a failover, and writing runbooks. Delays usually come from network and firewall approvals, certificate issuance, change windows and the time needed to agree on the failover option. The supported PostgreSQL versions you select also affect planning, since version 14 is supported until November 12, 2026, while version 18 is supported until November 14, 2030. Confirm your change calendar and approval chain before setting a date.
What does the work need from our team?
Your team needs to supply access and decisions, not only approvals. Expect to provide hosts or cloud accounts, network paths between the Central Server nodes and the database, DNS names, a certificate authority or approved certificate process for TLS, storage sizing, backup targets and a named owner for failover decisions. Your database and security staff should review the replication user, authentication method and certificate trust model, because those choices affect audit evidence. Your Central Server operators should confirm how the cluster behaves when the database changes role. Agree these responsibilities in the written scope so that gaps are visible before work starts.
Can our internal team set this up alone?
A team with working PostgreSQL administration skills and some X-Road experience can usually build a streaming standby alone, but the risk sits in the parts that are rarely practiced: TLS between nodes and the database, failover tooling and recovery drills. PostgreSQL does not detect a primary failure or notify the standby by itself, so automatic failover requires an external tool that your team must install, configure and test. Check whether your team has done a controlled switchover, a failed-primary recovery and a restore from backup in the last year. If any of these are missing, either schedule training or bring in an outside partner for the build and a supervised test.
Which failover option should we choose?
Choose the failover option by how much manual action you can accept during an outage and how much risk of split-brain your environment can tolerate. Manual promotion is the simplest to audit and requires a documented runbook and an on-call owner. Automatic failover needs an external tool that detects the failed primary, promotes the standby and redirects clients, and it must be tested with the X-Road Central Server nodes that depend on it. Synchronous replication reduces data loss on commit but makes commits wait for standbys, so it adds latency and can block writes if the standby is unavailable. Compare these trade-offs with your recovery time and recovery point expectations, and document the decision with its reasons.
Is a managed PostgreSQL service acceptable for the Central Server?
A managed service can be acceptable if it provides the PostgreSQL version, network controls, TLS and backup behavior your compliance and security teams require, and if it lets your team control where the data sits. The X-Road Security Server documentation names AWS RDS and Azure Database for PostgreSQL as remote options for its own database, but the Central Server design and your data location rules still need to be checked against your requirements. Ask the provider which PostgreSQL major versions it offers, how failover works, how it handles certificates for client connections, what logs it exposes to you, and how major upgrades are scheduled. Confirm these answers in writing before you choose a managed service.
What happens to Security Servers if the Central Server database goes down?
Security Servers that already hold a cached copy of the global configuration can usually keep exchanging messages while the Central Server database is unavailable, but configuration changes such as new members, services or access rights cannot be published until the database is back. The length of time Security Servers keep working on cached configuration, and what they do when the cache expires, must be confirmed against the current X-Road Central Server documentation for your release. Plan monitoring so that database failures alert your operators quickly, and rehearse recovery so that the outage window stays short.
How DeployOpen scopes and delivers this database setup
DeployOpen plans, builds and documents the PostgreSQL layer under a Central Server cluster in infrastructure you control, from the replication topology to the failover design. The work is agreed in a written, fixed scope before it starts, so the database design can be reviewed by your X-Road operators, security team and database administrators.
How we scope
- Confirm the PostgreSQL major version against the supported release dates in the versioning policy before choosing the build.
- Record whether the standby is local, in another site, or a managed service, and who operates each option.
- Agree in writing which failover tooling is in scope, and who owns the decision to promote a standby.
How we build
- Configure streaming replication between the primary and standby, with synchronous or asynchronous commit settings chosen and documented.
- Enable TLS between the Central Server nodes and the database, with certificate issuance and rotation steps written down.
- Test a planned switchover and an unplanned primary failure in a non-production copy before any production cutover.
How we hand over
- Deliver a runbook covering promotion, rejoining a former primary, connection settings and rollback steps.
- Document the authentication method, certificate chain, replication user and access rules for auditors and security reviewers.
- Walk your operations team through the tests performed and the evidence captured, so they can repeat them later.
How we support
- Offer ongoing support, planned minor updates and major upgrade planning as a retainer, if your operating model needs it.
- Repeat failover and restore tests on a schedule agreed in the retainer, and record the results.
- Review the database layer again when the X-Road release, PostgreSQL version or hosting platform changes.

