Running OpenBao HA on PostgreSQL storage

PostgreSQL is one of two officially supported HA backends for OpenBao. This page covers when it fits better than Raft, how the HA lock and read scaling work, and what the database cluster underneath must provide.

On this page

When running OpenBao HA on PostgreSQL storage fits your platform

Choose PostgreSQL storage for OpenBao high availability when your operations team already runs PostgreSQL well and would rather extend that skill than learn to operate Raft. The OpenBao HA design relies on the database for coordination: one active node holds a lock in the data store, and standby nodes forward or redirect requests to it. The OpenBao storage documentation describes PostgreSQL as an easier backend to operate safely than Raft, which is the main reason teams pick it.

Work through the lock behavior before you commit. Only the active node writes, so a lost lock or a failed active node triggers a standby to take over. Since OpenBao 2.7.0, standbys can also serve read-only operations on PostgreSQL, the same read scaling Raft gained in 2.5.0. Confirm with your OpenBao version and the OpenBao high availability docs whether your read traffic is a reason to pick this backend at all, because reads that must see the latest write need the consistency handling covered elsewhere on this page.

The database becomes a critical dependency. OpenBao is only as available as the PostgreSQL service behind it, so the database needs its own highly available design, with replication, failover tooling and tested recovery. PostgreSQL itself does not detect a failed primary or promote a standby, so your platform must supply that automation. If your team cannot run a highly available PostgreSQL cluster today, the Raft backend may be the simpler path, and that gap is the first thing to resolve.

How OpenBao nodes, the HA lock and PostgreSQL fit together

The diagram starts at the client network, where the load balancer sends writes to the active OpenBao node and reads to standbys. The active node holds the HA lock in PostgreSQL, and standbys watch that lock and forward writes to the active node. Both OpenBao and the PostgreSQL primary and standby sit inside the trust boundary you control. Check that standbys serve reads only on OpenBao 2.7.0 or later, and confirm which health checks your load balancer uses before routing traffic.

Writes go to the active node, reads can reach standbys, and the HA lock lives in PostgreSQL.

PostgreSQL versus Raft: which HA backend fits

This table compares PostgreSQL and integrated Raft storage for OpenBao HA on operational ownership, safe operation, read scaling, skills and backup tooling. Read the rows marked for confirmation against your own database team, network layout and recovery targets before deciding.

Decision factorPostgreSQL storageIntegrated Raft storage
Operational ownershipA database platform your team already runs, with its own patching, replication and failover toolingOpenBao nodes hold the cluster data themselves, so OpenBao operations own the replication and membership work
Documented operating modelThe OpenBao storage docs describe PostgreSQL as an easier backend to operate safely than RaftSupported HA backend with its own voter, quorum and membership procedures that the team must rehearse
Read scalingStandbys can serve read-only operations since OpenBao 2.7.0, giving horizontal read scalingStandbys serve read-only operations since OpenBao 2.5.0, so read capacity is available on either backend
Existing skillsGood fit if your team already backs up, tunes and restores PostgreSQL clustersGood fit if your team is comfortable operating Raft quorum and snapshot procedures in OpenBao
Backup toolingReuse your PostgreSQL backup, archiving and point-in-time recovery practice, with restore rehearsals confirmed for OpenBao dataRely on Raft snapshots taken with OpenBao tooling, with restore rehearsals run against the cluster
Automatic failover of the databasePostgreSQL does not detect primary failure on its own, so external failover tooling is requiredLeader election is handled inside the OpenBao Raft cluster
Confirm in your environmentMinimum PostgreSQL version your OpenBao release requires, HA lock behavior and cluster topologyNode count, network latency between voters and disk performance for your write volume

Configuring the HA lock, table and max_parallel settings

The PostgreSQL backend is configured through a small set of storage keys that control where OpenBao keeps its encrypted data, which database role it uses, how the active node holds the HA lock and how many storage operations run at once. Each setting interacts with the others, so confirm every key and default against the current OpenBao storage and HA documentation before you deploy.

Connection string and database role

The connection_url key tells OpenBao where PostgreSQL is and which role it logs in as. Create a dedicated role that can read and write only the OpenBao table and lock entries, not a shared application or superuser account. Confirm the accepted URL format, the TLS parameters supported by your OpenBao version, and where the password is supplied so it stays out of plain configuration files.

Storage docs

Table name and schema ownership

The table key names the table where OpenBao stores its encrypted key-value entries. Decide who creates that table and who owns it before the first start, since a schema created by a migration account can later block upgrades if privileges are missing. Confirm whether OpenBao creates the table itself, whether you can pre-create it, and which privileges each role needs during upgrades.

HA lock behavior and enablement

With ha_enabled set, one node holds a lock in PostgreSQL and acts as the active node, while standbys wait to take over or forward requests. Confirm the lock timing options and how a standby detects a lost lock in your version. PostgreSQL does not detect primary failure or move traffic for you, so the lock alone does not provide automatic database failover.

HA docs

The max_parallel limit

The max_parallel key caps how many storage requests OpenBao sends to PostgreSQL at the same time. Set it with the total connection budget in mind: every OpenBao node multiplies the connections it can open, and a connection pooler such as PgBouncer can change how those limits behave. Confirm the default and the valid range in the storage docs, then load test with realistic secret volumes.

PostgreSQL version and read scaling

Choose a PostgreSQL major version that is still in its support window at go-live and for the planned operating period. Read scaling on PostgreSQL arrived in OpenBao 2.7, so confirm the minimum PostgreSQL version that your target OpenBao release requires. Plan standby reads and the minimum version together, because a version that is too old may block the read scaling you planned to use.

PostgreSQL 18 final release
2030
PostgreSQL support policy

Pre-deployment confirmation checklist

Before deployment, write down the exact OpenBao release, the PostgreSQL major version, and the value of each key used in the cluster configuration. Confirm the table name, lock settings, pool limits and TLS options against the documentation for that release, not an older guide. Keep the checked file under version control so that any later change is traceable during an upgrade or an audit.

Setup sequence for OpenBao on PostgreSQL

This sequence takes a PostgreSQL-backed OpenBao cluster from a confirmed database version to a verified active and standby pair, with a tested failover before anything is loaded into it.

  1. Confirm a supported PostgreSQL major version

    Your database team checks that the PostgreSQL major version you plan to use is still in its support window. The versioning policy lists 14 through 18 as supported, with 14 ending November 12, 2026 and 18 ending November 14, 2030, so choose a version that will outlast your planned OpenBao lifecycle. Confirm the version with the database owner and record it in the design. The step is done when the version, its end-of-support date and the planned upgrade path are written down and approved.

  2. Create a least-privilege database role

    The database administrator creates a dedicated role and an empty database for OpenBao storage, grants it access only to that database and its schema, and does not use a superuser or a shared application account. Passwords should follow the authentication method your PostgreSQL standard requires, such as SCRAM, since MD5 is deprecated. Confirm the role can connect and read and write the storage table, and that no other role can read it. The step is done when a test login with the new role succeeds and a login with a different role is refused.

  3. Configure the storage stanza and HA settings

    The platform engineer writes the OpenBao configuration with a PostgreSQL storage stanza that points at the database, the dedicated role and the chosen table, and sets the HA-related options so that the cluster can elect one active node through the database lock. Review the max_parallel setting and the table name against your database standards before the first start. Keep the connection string and credentials out of plain configuration files where your secrets practice requires it. The step is done when the configuration file validates and every node carries the same storage settings.

  4. Start the nodes and initialize the cluster

    The operator starts each OpenBao node with the same configuration, then initializes one node and records the unseal material under your key custody process. Each node is unsealed using that material, following the seal design your organization has approved. Check that the nodes start without errors in their logs and that the initialization completes on the first node only. The step is done when the first node reports initialized and unsealed and the other nodes reach a sealed or standby state without manual intervention beyond their unseal.

  5. Verify active and standby roles through the health endpoint

    The operator queries the /sys/health endpoint on each node and confirms that exactly one node reports active and the others report standby. The default status codes are documented, so load balancer checks can rely on them. Confirm that a standby still reports healthy for the probes you plan to use, and that only one node holds the active lock in the database. The step is done when the role of each node matches the expected output and the lock state in PostgreSQL agrees with the health results.

  6. Test failover by stopping the active node

    With test data written, the operator stops the active node in a controlled window and watches for a standby to take over the lock. Measure how long the cluster takes to elect a new active node and confirm that requests made during the transition return the expected errors or retries. Restart the stopped node and confirm it rejoins as a standby. Note that PostgreSQL itself does not detect primary failure or notify standbys, so this test covers the OpenBao side only and the database failover design must be tested separately. The step is done when a new active node is confirmed, the test data is intact and the recovery steps are documented.

  7. Document the cluster and its recovery path

    The team records the final configuration, the PostgreSQL version, the role and privilege model, the health check results and the failover test outcome in the operations runbook. The runbook names the owner of the database, the owner of OpenBao and the owner of unseal material, and states the steps for a database restore and a node replacement. Review it with both teams before go-live. The step is done when the runbook is signed off and each named owner confirms they can execute their part.

How standby read scaling works on PostgreSQL since 2.7

OpenBao 2.7.0 extended read-only standby serving to the PostgreSQL storage backend. Earlier, the same capability applied only to Raft standbys, which 2.5.0 introduced. On a PostgreSQL-backed cluster, the active node still holds the HA lock and handles writes, while standby nodes can answer read-only requests. Each added standby therefore adds read capacity without adding another writer, which is the practical meaning of horizontal read scaling here. The gain is in reads only: write throughput still depends on the active node and the database behind it.

The trade-off is staleness. A standby reads from the shared PostgreSQL data, so a read sent to a standby right after a write may not yet reflect that write. Applications that write a value and immediately read it back can see the old value, and a secret rotation or policy change can appear late on some nodes. Before you send traffic to standbys, decide which read paths can tolerate a short delay and which need the latest state. Confirm in the OpenBao documentation for your target version how a client can request consistent reads, and test that behavior against your own load balancer configuration.

Plan the read-consistency handling as a separate step, not an afterthought. The companion topic on read-after-write consistency explains the consistency mechanisms available in 2.7 and how they apply to standby reads, so this page does not repeat them. Your checklist should cover which clients may use standbys, how your load balancer routes them (see the health check topic for status codes), and how you will test a write-then-read sequence across nodes before production use. Keep in mind that a standby is only as current as the PostgreSQL replication behind it, so the replication health of your database cluster directly affects how fresh those reads are.

Security and operational considerations for the database layer

When PostgreSQL holds OpenBao's storage, every secret ciphertext, lock record and backup depends on the database's security and recovery posture. The cards below cover the decisions that connect the OpenBao cluster to the database, from how it authenticates and where it can be reached to how its data is archived and who holds its credentials.

Choose the authentication method

OpenBao connects to PostgreSQL as a database role, so the authentication method on the server decides how that login is proven. Check that the storage role uses SCRAM-SHA-256 and not MD5. PostgreSQL 18 deprecated MD5 password authentication in favor of SCRAM, so older pg_hba.conf entries and role passwords should be reviewed during the upgrade. Confirm which method your PostgreSQL version and client support before you choose between password, certificate and directory-based methods.

PostgreSQL authentication methods

Restrict network paths to the database

Only OpenBao nodes should reach the PostgreSQL port used for storage. Limit this with host-based rules in pg_hba.conf, firewall policy and private subnets, and keep administrative access on a separate path. Remember that the OpenBao HA lock and every encrypted secret pass through this connection, so a reachable database endpoint widens the attack surface of the whole secrets platform. Ask your network team to document which source addresses are permitted and to test that other hosts are refused.

Keep secret data encrypted at rest

OpenBao encrypts secret values before it writes them to storage, so the rows in PostgreSQL hold ciphertext rather than plaintext secrets. Database-level encryption of disks and backups is still worth confirming because it protects metadata, the lock record and any data outside OpenBao's encryption boundary. Verify the seal configuration and key custody separately, because a database copy without the unseal path is not the same as a readable secrets store.

OpenBao storage docs

Archive WAL for point-in-time recovery

Nightly dumps alone leave a gap between the last backup and a corruption or deletion event. Continuous archiving ships write-ahead log segments to separate storage, which allows point-in-time recovery to a chosen moment. Pair it with a base backup and rehearse a restore to a new cluster. Confirm the archive location is outside the failure domain of the primary, how long archives are retained, and who can start a restore. Restores of OpenBao storage should be tested together with the unseal and key procedures, not only the database.

Continuous archiving docs

Define who holds database credentials

The storage role's password or certificate is a high-value credential, because it grants read and write access to the encrypted secret store and its lock table. Decide who can create, rotate and read it, and keep it out of configuration files that developers can read. Separate the OpenBao storage role from administrative and application roles, and record who can change pg_hba.conf. Ask your team to confirm how rotation is scheduled and how a rotated credential reaches each OpenBao node without a full outage.

Plan failover authority for PostgreSQL

PostgreSQL does not detect a failed primary or promote a standby on its own, so an external tool must make that decision. Confirm which component fences the old primary, who approves a promotion and how OpenBao nodes are pointed at the new primary. An unclear failover path can leave the secrets platform sealed or split between two writers. Document the runbook and rehearse it, because the database layer's availability sets the ceiling for OpenBao's.

PostgreSQL failover docs

Questions teams ask before running OpenBao HA on PostgreSQL

What drives the cost of running OpenBao HA on PostgreSQL?

The main cost drivers are the scope of the database work, the number of environments, and how much of the high availability stack you already run. OpenBao itself is open source under MPL-2.0, so the spend is in people and infrastructure: PostgreSQL nodes, failover tooling, load balancing, backup storage and the time to build and test them. Recurring costs include the infrastructure, PostgreSQL minor updates, and ongoing monitoring. Ask any partner for a quote that separates one-time build work from retainer or run work, and that lists which PostgreSQL and failover components are included.

Who pays for database high availability and failover tooling?

Your organization pays for the database platform and its operating model, because PostgreSQL does not include automatic failover. The documentation states that PostgreSQL does not provide the software to detect a primary failure and notify the standby, so you need external tooling for automatic failover. That tooling, its licensing if any, and the staff who operate it sit with you or with a services partner. Confirm early whether your existing PostgreSQL platform already provides failover detection, and who on your team owns its runbooks.

Who is responsible for backups and restore testing?

Backups and restore tests are a shared responsibility, and the database team should own them. OpenBao's data lives in PostgreSQL in this design, so a restore of the database is what recovers secrets. PostgreSQL's continuous archiving and point-in-time recovery documentation describes the mechanisms, but choosing the retention period, storage location, encryption and restore rehearsal schedule is your decision. Ask for a written restore test that proves OpenBao comes back unsealed and serving secrets after recovery.

How long does an OpenBao HA on PostgreSQL build take?

Duration depends mostly on how much PostgreSQL experience your team already has. A team that already runs highly available PostgreSQL with tested failover and backups will need far less time than one that is building that capability alongside OpenBao. No fixed duration applies to every environment, so the timeline should come from the written scope, including network design, failover tests and the planned upgrade path. Ask for a schedule with named milestones and a retest step before production cutover.

What does the work need from our DBAs and security team?

Your DBAs need to own the PostgreSQL cluster design, replication mode, failover tooling, connection pooling and major upgrade plan. The security team needs to approve authentication methods, TLS, network paths, privileged database accounts and audit evidence. PostgreSQL supports several client authentication methods, including certificate and LDAP, and the choice should match your identity model. Agree early on who approves changes to the HA lock configuration and who receives alerts when a failover occurs.

Can our internal team build this without outside help?

Yes, a capable internal team can build it, provided it has PostgreSQL operations skills and time to test failover before go-live. The harder part is ongoing operation: minor updates, major upgrades, failover drills and backup verification all recur. A useful test is whether your team has already run a highly available PostgreSQL cluster in production. If not, a fixed-scope engagement can cover the build and handover, while retainers can cover upgrades and continuous testing.

How do PostgreSQL version support and upgrades affect the plan?

Plan upgrades before you build, because each PostgreSQL major version has a fixed support window. The versioning policy lists version 14 as supported until November 12, 2026, and version 18 until November 14, 2030. Minor releases do not change the storage format and only require replacing executables and restarting, while major upgrades use pg_dumpall, pg_upgrade or logical replication. Ask your partner which major version they will deploy and how the upgrade path will be tested against OpenBao.

How DeployOpen scopes and delivers OpenBao HA on PostgreSQL

DeployOpen approaches OpenBao HA on PostgreSQL storage as a fixed-scope engagement in infrastructure you control. We start from your database platform, recovery targets and compliance evidence needs, then build, test, document and hand over the cluster so your team can operate it.

How we scope

  • Confirm whether your organization already runs a PostgreSQL platform that can host the OpenBao lock and data tables.
  • Record the PostgreSQL major version you will run and check it against the supported version dates in the versioning policy.
  • Agree in writing the failover tooling, connection pooling approach, backup targets and standby read scope before work starts.

How we build

  • Configure the OpenBao storage stanza, table and max_parallel settings, and the HA lock against your PostgreSQL cluster.
  • Build the PostgreSQL primary and standby topology, synchronous or asynchronous replication, and the external failover tooling you select.
  • Test active node failover, standby read behavior on OpenBao 2.7 and later, and recovery from a lost PostgreSQL primary before sign-off.

How we hand over

  • Deliver architecture records, configuration files, and runbooks for failover, unseal, version upgrades and PostgreSQL major upgrades.
  • Document the verification results, including failover tests and restore rehearsals, so your security and compliance teams can review them.
  • Walk your platform, database and security staff through the operating model and the decisions behind each setting.

How we support

  • Support is available as a retainer covering OpenBao and PostgreSQL upgrades, patching and periodic failover and restore testing.
  • Ask in your quote which PostgreSQL and OpenBao versions the support covers and how the retainer handles minor and major upgrades.
  • Confirm with your database team who owns PostgreSQL backups, point-in-time recovery and connection pooling after handover.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.