EDB Failover Manager for EPAS 18 on RHEL 10: Setup and Failover Tests

In my previous post we installed EDB Postgres Advanced Server 18 (EPAS) on a RHEL 10 virtual machine (lin8). A single database server is a single point of failure, so in this post we turn it into a high availability cluster with EDB Failover Manager (EFM): we add a streaming replication standby (lin7) and a witness node (lin6), let a virtual IP address (VIP) follow the primary and then break things on purpose to see how EFM reacts.

EFM is EDB’s high availability tool for primary/standby clusters that use Postgres streaming replication. A Java based agent runs on every node, the agents talk to each other via JGroups, monitor the local databases and, when the primary fails, promote a standby, move the VIP and fence the old primary. At the time of writing the current release is EFM 5.5. Version 5.0 was the first new major release in years: it changed how cluster size and quorum are calculated and introduced the efm create-standby command, which we will use to rebuild nodes after the failover tests.

Why a witness node? EFM needs at least three agents to have a quorum. With only a primary and a standby, the standby cannot distinguish a dead primary from a network split between the two nodes. A third node – either another standby or a lightweight witness that runs only the EFM agent and no database – breaks the tie.

What about pgBouncer? In production, clients often connect through a connection pooler that EFM re-points after a failover. To keep this post focused on EFM itself, clients will use the VIP here. The integration of EDB PgBouncer with EFM, including its own failover tests, will follow in a separate post.

Architecture and Prerequisites

HostRoleIP addressSoftware
lin8Primary (existing server from the previous post)11.1.1.196EPAS 18, EFM 5.5
lin7Standby (new)11.1.1.195EPAS 18, EFM 5.5
lin6Witness (new)11.1.1.186EFM 5.5 only
VIPAlways points to the current primary11.1.1.200–

The IP addresses, the gateway 11.1.1.222 and the network interface enp0s3 are the values of my lab – replace them with the values of your environment (ip -br addr shows the interface names). All three nodes and the VIP must be in the same subnet, because the VIP is moved between the nodes on layer 2.

RequirementDetails
Operating SystemRed Hat Enterprise Linux 10 on all nodes. lin7 should be sized like lin8 (4GB RAM, 2 vCPUs, 30GB storage), the witness lin6 needs far less (e.g. 2GB RAM, 1 vCPU, 20GB storage).
EDB AccountThe same EDB account and repository token as in the previous post. EFM is part of the EDB subscription; the trial subscription is for testing and evaluation only.
JavaEFM 5.x requires Java 17 or later. We install OpenJDK 21 from the RHEL repositories.
NetworkTCP port 5444 between lin8 and lin7 (Postgres), TCP port 7800 between all three nodes (EFM agents).
Root/Sudo AccessFull administrative privileges on all VMs.

Note: The second EPAS cluster in Postgres mode (port 5445) from the previous post is not part of the HA setup. Stop it (and disable its systemd unit, if you created one) to avoid confusion during the tests. EFM manages the Redwood mode cluster on port 5444 with the service edb-as-18 and the data directory /var/lib/edb/as18/data.

1. Prepare the New Nodes

1.1 Install RHEL 10 and set up /etc/hosts

Install RHEL 10 on lin7 and lin6 the same way as lin8 (see also here). The host name is set during the installation (e.g. lin7.fritz.box). Some commands in this post use the host names, so all three nodes get the same, complete /etc/hosts – then the cluster does not depend on the DNS of the router. The following script creates the entries on every node:

# run as root on lin8, lin7 and lin6
cp -p /etc/hosts /etc/hosts.bak
while read -r ip fqdn short; do
  # remove existing entries for this IP or host name (comments are kept)
  sed -i -E "/^[[:space:]]*#/! { /(^|[[:space:]])(${ip//./\\.}|$short)([[:space:]]|$)/d; }" /etc/hosts
  echo "$ip  $fqdn $short" >> /etc/hosts
done << 'EOF'
11.1.1.196 lin8.fritz.box lin8
11.1.1.195 lin7.fritz.box lin7
11.1.1.186 lin6.fritz.box lin6
EOF

Adapt the IP addresses and the domain to your environment. The script first removes every existing entry for these IP addresses or host names – e.g. the line the installer created for the local host – and then appends the three entries. So it can be run several times and leaves exactly the same three lines on every node; entries for other hosts and the comments are not touched. The original file is saved as /etc/hosts.bak. Check the result:

# run on lin8, lin7 and lin6
cat /etc/hosts
getent hosts lin8 lin7 lin6

1.2 Install EPAS 18 on the standby lin7

On lin7 we repeat chapters 1.2 to 1.5 of the previous post: prepare the OS, add the EDB repository, install EPAS 18 and customize the enterprisedb OS user. Do not initialize a cluster – the data directory of the standby will be created with pg_basebackup from the primary.

# run as root on lin7
dnf -y update
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
dnf config-manager --set-enabled codeready-builder-for-rhel-10-x86_64-rpms
curl -1sSLf 'https://downloads.enterprisedb.com/<your-token>/enterprise/setup.rpm.sh' | bash
dnf -y install edb-as18-server

1.3 Prepare the witness lin6

The witness does not need a database. We only add the EPEL and EDB repositories, so that we can install EFM later:

# run as root on lin6
dnf -y update
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm
curl -1sSLf 'https://downloads.enterprisedb.com/<your-token>/enterprise/setup.rpm.sh' | bash

1.4 Open the firewall

The database nodes need port 5444 for client connections and replication (already done on lin8 if you followed chapter 2.2 of the previous post). All nodes need port 7800 for the communication between the EFM agents. The EFM admin port 7809 is only used locally and does not need to be opened.

# run as root on lin8 and lin7
firewall-cmd --permanent --add-port=5444/tcp

# run as root on lin8, lin7 and lin6
firewall-cmd --permanent --add-port=7800/tcp
firewall-cmd --reload
firewall-cmd --list-ports

2. Prepare the Primary lin8 for Replication

2.1 Create the replication and EFM database users

We need two database roles: repuser for streaming replication and efm, which the EFM agents use to monitor the databases. EFM does not need a superuser; the required privileges are listed in the EFM prerequisites. The REPLICATION attribute for efm is only needed for some optional features (e.g. replication slot synchronization), but it does no harm in our lab. Please use better passwords than changeme outside of a lab.

# run as root on lin8
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
CREATE ROLE repuser WITH REPLICATION LOGIN PASSWORD 'changeme';

CREATE ROLE efm WITH LOGIN REPLICATION PASSWORD 'changeme';
GRANT pg_read_all_settings TO efm;
GRANT EXECUTE ON FUNCTION pg_current_wal_lsn() TO efm;
GRANT EXECUTE ON FUNCTION pg_last_wal_replay_lsn() TO efm;
GRANT EXECUTE ON FUNCTION pg_wal_replay_resume() TO efm;
GRANT EXECUTE ON FUNCTION pg_wal_replay_pause() TO efm;
GRANT EXECUTE ON FUNCTION pg_reload_conf() TO efm;

\du repuser
\du efm
EOF
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
CREATE ROLE repuser WITH REPLICATION LOGIN PASSWORD 'changeme';

CREATE ROLE efm WITH LOGIN REPLICATION PASSWORD 'changeme';
GRANT pg_read_all_settings TO efm;
GRANT EXECUTE ON FUNCTION pg_current_wal_lsn() TO efm;
GRANT EXECUTE ON FUNCTION pg_last_wal_replay_lsn() TO efm;
GRANT EXECUTE ON FUNCTION pg_wal_replay_resume() TO efm;
GRANT EXECUTE ON FUNCTION pg_wal_replay_pause() TO efm;
GRANT EXECUTE ON FUNCTION pg_reload_conf() TO efm;

\du repuser
\du efm
EOF
CREATE ROLE
CREATE ROLE
GRANT ROLE
GRANT
GRANT
GRANT
GRANT
GRANT
        List of roles
 Role name |   Attributes
-----------+-----------------
 repuser   | Replication    +
           | Profile default

        List of roles
 Role name |   Attributes
-----------+-----------------
 efm       | Replication    +
           | Profile default

[root@lin8 ~]#

2.2 Replication parameters

The defaults of EPAS 18 already fit streaming replication (wal_level = replica, max_wal_senders = 10, hot_standby = on). We additionally enable wal_log_hints (a prerequisite for pg_rewind) and keep 1GB of WAL on the primary so that a standby that is down for a short while can catch up. To keep the lab simple we do not use replication slots – see the production considerations at the end.

# run as root on lin8
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
ALTER SYSTEM SET wal_log_hints = on;
ALTER SYSTEM SET wal_keep_size = '1GB';
EOF

2.3 pg_hba.conf

The entry for all databases from the previous post does not cover replication connections, so we add explicit entries for the cluster network. pg_hba.conf is part of the data directory and will be copied to the standby by pg_basebackup. The replication entry for enterprisedb is needed by efm create-standby (chapter 6.6): it runs pg_basebackup without a user name, so the connection is made as the OS user enterprisedb.

# run as root on lin8
cat >> /var/lib/edb/as18/data/pg_hba.conf << 'EOF'
# streaming replication and EFM
host  replication  repuser  11.1.1.0/24  scram-sha-256
host  replication  efm      11.1.1.0/24  scram-sha-256
host  replication  enterprisedb  11.1.1.0/24  scram-sha-256
host  edb          efm      11.1.1.0/24  scram-sha-256
EOF

# wal_log_hints requires a restart
systemctl restart edb-as-18
su - enterprisedb -c "psql -d edb -c 'show wal_log_hints' -c 'show wal_keep_size'"
Sample Output (click to expand)
[root@lin8 ~]# # run as root on lin8
cat >> /var/lib/edb/as18/data/pg_hba.conf << 'EOF'
# streaming replication and EFM
host  replication  repuser  11.1.1.0/24  scram-sha-256
host  replication  efm      11.1.1.0/24  scram-sha-256
host  edb          efm      11.1.1.0/24  scram-sha-256
EOF

# wal_log_hints requires a restart
systemctl restart edb-as-18
su - enterprisedb -c "psql -d edb -c 'show wal_log_hints' -c 'show wal_keep_size'"
 wal_log_hints
---------------
 on
(1 row)

 wal_keep_size
---------------
 1GB
(1 row)

[root@lin8 ~]#

2.4 Password file for the enterprisedb OS user

The standby, pg_basebackup and later efm create-standby run as enterprisedb and read the passwords from ~/.pgpass. Create the file on lin8 and lin7, because each node can become primary or standby:

# run as root on lin8 and lin7
su - enterprisedb -c 'cat > ~/.pgpass && chmod 600 ~/.pgpass' << 'EOF'
*:5444:replication:repuser:changeme
*:5444:replication:efm:changeme
*:5444:edb:efm:changeme
*:5444:replication:enterprisedb:changeme
EOF
su - enterprisedb -c 'ls -l ~/.pgpass'

3. Create the Standby on lin7

3.1 Clone the primary with pg_basebackup

The option -R writes primary_conninfo into postgresql.auto.conf and creates the file standby.signal, so the new cluster starts as a standby:

# run as root on lin7
su - enterprisedb << 'EOF'
ls -la /var/lib/edb/as18/data   # must be empty or not exist
/usr/edb/as18/bin/pg_basebackup -h lin8 -p 5444 -U repuser \
  -D /var/lib/edb/as18/data -X stream -R -P
cat /var/lib/edb/as18/data/postgresql.auto.conf
ls -l /var/lib/edb/as18/data/standby.signal
EOF
Sample Output (click to expand):
[root@lin7 ~]# # run as root on lin7
su - enterprisedb << 'EOF'
ls -la /var/lib/edb/as18/data   # must be empty or not exist
/usr/edb/as18/bin/pg_basebackup -h lin8 -p 5444 -U repuser \
  -D /var/lib/edb/as18/data -X stream -R -P
cat /var/lib/edb/as18/data/postgresql.auto.conf
ls -l /var/lib/edb/as18/data/standby.signal
EOF
Last login: Tue Nov 24 12:40:26 CET 2026 on pts/0
total 0
drwx------ 2 enterprisedb enterprisedb  6 Nov 10 01:00 .
drwx------ 4 enterprisedb enterprisedb 33 Nov 24 12:27 ..
60196/60196 kB (100%), 1/1 tablespace
# Do not edit this file manually!
# It will be overwritten by the ALTER SYSTEM command.
wal_log_hints = 'on'
wal_keep_size = '1GB'
primary_conninfo = 'user=repuser passfile=''/var/lib/edb/.pgpass'' channel_binding=prefer host=lin8 port=5444 sslmode=prefer sslnegotiation=postgres sslcompression=0 sslcertmode=allow sslsni=1 ssl_min_protocol_version=TLSv1.2 gssencmode=prefer krbsrvname=postgres gssdelegation=0 target_session_attrs=any load_balance_hosts=disable'
-rw------- 1 enterprisedb enterprisedb 0 Nov 24 12:41 /var/lib/edb/as18/data/standby.signal
[root@lin7 ~]#

3.2 Start the standby

# run as root on lin7
systemctl enable --now edb-as-18
systemctl status edb-as-18

3.3 Verify the replication

# run as root on lin8 (primary)
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
SELECT client_addr, application_name, state, sync_state, replay_lsn
FROM pg_stat_replication;
EOF
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8 (primary)
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
SELECT client_addr, application_name, state, sync_state, replay_lsn
FROM pg_stat_replication;
EOF
 client_addr | application_name |   state   | sync_state | replay_lsn
-------------+------------------+-----------+------------+------------
 11.1.1.195  | walreceiver      | streaming | async      | 0/5000168
(1 row)

[root@lin8 ~]#

# run as root on lin7 (standby)
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
SELECT pg_is_in_recovery(), pg_last_wal_replay_lsn();
EOF
Sample Output (click to expand):
[root@lin7 ~]# # run as root on lin7 (standby)
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
SELECT pg_is_in_recovery(), pg_last_wal_replay_lsn();
EOF
 pg_is_in_recovery | pg_last_wal_replay_lsn
-------------------+------------------------
 t                 | 0/5000168
(1 row)

[root@lin7 ~]#

state = streaming on the primary and pg_is_in_recovery() = t on the standby show that the replication works. A table created on lin8 is now visible on lin7 a moment later, while write attempts on lin7 fail with cannot execute … in a read-only transaction.

4. Install and Configure EFM

4.1 Install the packages

EFM is installed on all three nodes. The package name contains the version (edb-efm55 for 5.5), so check first which version is available in your repository and adapt the version numbers in all paths and service names below if necessary:

# run as root on lin8, lin7 and lin6
dnf list 'edb-efm*'
dnf -y install java-21-openjdk-headless edb-efm55
java -version
ls /etc/edb/efm-5.5 /usr/edb/efm-5.5/bin
Sample Output (click to expand):
[root@lin7 ~]# # run as root on lin8, lin7 and lin6
dnf list 'edb-efm*'
dnf -y install java-21-openjdk-headless edb-efm55
java -version
ls /etc/edb/efm-5.5 /usr/edb/efm-5.5/bin
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:32 ago on Tue 24 Nov 2026 01:07:07 PM CET.
Available Packages
edb-efm53.x86_64                                                            5.3-1.el10                                                   enterprisedb-enterprise
edb-efm53-debuginfo.x86_64                                                  5.3-1.el10                                                   enterprisedb-enterprise
edb-efm54.x86_64                                                            5.4-1.el10                                                   enterprisedb-enterprise
edb-efm54-debuginfo.x86_64                                                  5.4-1.el10                                                   enterprisedb-enterprise
edb-efm55.x86_64                                                            5.5-1.el10                                                   enterprisedb-enterprise
edb-efm55-debuginfo.x86_64                                                  5.5-1.el10                                                   enterprisedb-enterprise
Updating Subscription Management repositories.
Last metadata expiration check: 0:00:35 ago on Tue 24 Nov 2026 01:07:07 PM CET.
Dependencies resolved.
================================================================================================================================================================
 Package                                  Architecture           Version                                Repository                                         Size
================================================================================================================================================================
Installing:
 edb-efm55                                x86_64                 5.5-1.el10                             enterprisedb-enterprise                            13 M
 java-21-openjdk-headless                 x86_64                 1:21.0.13.1.2-1.2.el10                 rhel-10-for-x86_64-appstream-rpms                  49 M
Installing dependencies:
 javapackages-filesystem                  noarch                 6.4.0-1.el10                           rhel-10-for-x86_64-appstream-rpms                  19 k
 lksctp-tools                             x86_64                 1.0.21-1.el10                          rhel-10-for-x86_64-baseos-rpms                     98 k
 tzdata-java                              noarch                 2026f-1.el10_3                         rhel-10-for-x86_64-appstream-rpms                  52 k

Transaction Summary
================================================================================================================================================================
Install  5 Packages

Total size: 62 M
Total download size: 62 M
Installed size: 228 M
Downloading Packages:
[SKIPPED] javapackages-filesystem-6.4.0-1.el10.noarch.rpm: Already downloaded
(2/5): tzdata-java-2026f-1.el10_3.noarch.rpm                                                                                     35 kB/s |  52 kB     00:01
(3/5): edb-efm55-5.5-1.el10.x86_64.rpm                                                                                          7.5 MB/s |  13 MB     00:01
(4/5): lksctp-tools-1.0.21-1.el10.x86_64.rpm                                                                                    135 kB/s |  98 kB     00:00
(5/5): java-21-openjdk-headless-21.0.13.1.2-1.2.el10.x86_64.rpm                                                                 6.0 MB/s |  49 MB     00:08
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                           7.5 MB/s |  62 MB     00:08
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Running scriptlet: java-21-openjdk-headless-1:21.0.13.1.2-1.2.el10.x86_64                                                                                 1/1
  Preparing        :                                                                                                                                        1/1
  Installing       : lksctp-tools-1.0.21-1.el10.x86_64                                                                                                      1/5
  Installing       : tzdata-java-2026f-1.el10_3.noarch                                                                                                      2/5
  Installing       : javapackages-filesystem-6.4.0-1.el10.noarch                                                                                            3/5
  Installing       : java-21-openjdk-headless-1:21.0.13.1.2-1.2.el10.x86_64                                                                                 4/5
  Running scriptlet: java-21-openjdk-headless-1:21.0.13.1.2-1.2.el10.x86_64                                                                                 4/5
  Running scriptlet: edb-efm55-5.5-1.el10.x86_64                                                                                                            5/5
  Installing       : edb-efm55-5.5-1.el10.x86_64                                                                                                            5/5
  Running scriptlet: edb-efm55-5.5-1.el10.x86_64                                                                                                            5/5
Installed products updated.

Installed:
  edb-efm55-5.5-1.el10.x86_64               java-21-openjdk-headless-1:21.0.13.1.2-1.2.el10.x86_64         javapackages-filesystem-6.4.0-1.el10.noarch
  lksctp-tools-1.0.21-1.el10.x86_64         tzdata-java-2026f-1.el10_3.noarch

Complete!
openjdk version "21.0.13.1" 2026-11-17 LTS
OpenJDK Runtime Environment (Red_Hat-21.0.13.1.2-1) (build 21.0.13.1+2-LTS)
OpenJDK 64-Bit Server VM (Red_Hat-21.0.13.1.2-1) (build 21.0.13.1+2-LTS, mixed mode, sharing)
/etc/edb/efm-5.5:
efm.nodes.in  efm.properties.in

/usr/edb/efm-5.5/bin:
efm  efm_address  efm_db_functions  efm_pgpool_functions  efm_root_functions  runefm.sh  runJavaApplication.sh  secure
[root@lin7 ~]#

The package creates the OS user efm, the binaries in /usr/edb/efm-5.5/bin, the configuration templates in /etc/edb/efm-5.5, the systemd unit edb-efm-5.5 and a sudoers file that allows efm to control the database service and the VIP.

4.2 Encrypt the database password

EFM stores the password of the database user in encrypted form. The cluster name (efm) is part of the encryption and also determines the names of the configuration files (efm.properties, efm.nodes):

# run as root on lin8
/usr/edb/efm-5.5/bin/efm encrypt efm
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
/usr/edb/efm-5.5/bin/efm encrypt efm
This utility will generate an encrypted password for you to place in your
EFM cluster property file: /etc/edb/efm-5.5/efm.properties

Please enter the password and hit enter:

Please enter the password again to confirm:

The encrypted password is: 05f09fe12220c81e2d46c40b548e0838

Please paste this into your efm.properties file
        db.password.encrypted=05f09fe12220c81e2d46c40b548e0838

The /etc/edb/efm-5.5/efm.properties file does not exist.
Make sure you are using the correct cluster name.
[root@lin8 ~]#

4.3 A simple notification script

EFM can send e-mails for every cluster event, but this requires an SMTP server on every node. In the lab, a small script that writes the events to the system journal is more convenient – and very useful to follow the failover tests:

# run as root on lin8, lin7 and lin6
cat > /usr/local/bin/efm_notify.sh << 'EOF'
#!/bin/bash
# $1 = subject, $2 = message (passed by EFM)
logger -t efm-notify "$1: $2"
EOF
chmod 755 /usr/local/bin/efm_notify.sh

# follow the events later with
journalctl -t efm-notify -f

4.4 efm.properties on lin8

We create the working copies of the templates and set the relevant properties. The small loop replaces the value of each listed property in the template, so we do not have to search the long file manually. Insert the encrypted password from step 4.2:

# run as root on lin8
cd /etc/edb/efm-5.5
cp efm.properties.in efm.properties
cp efm.nodes.in efm.nodes
chown efm:efm efm.nodes; chmod 600 efm.nodes
# efm.properties must also be readable by the database owner
chown efm:enterprisedb efm.properties; chmod 640 efm.properties

while IFS='=' read -r key value; do
  sed -i "s|^$key=.*|$key=$value|" efm.properties
done << 'EOF'
db.user=efm
db.password.encrypted=<encrypted password from step 4.2>
db.port=5444
db.database=edb
db.service.owner=enterprisedb
db.service.name=edb-as-18
db.bin=/usr/edb/as18/bin
db.data.dir=/var/lib/edb/as18/data
user.email=
script.notification=/usr/local/bin/efm_notify.sh %s %s
bind.address=11.1.1.196:7800
is.witness=false
ping.server.ip=11.1.1.222
auto.allow.hosts=true
stable.nodes.file=true
virtual.ip=11.1.1.200
virtual.ip.interface=enp0s3
virtual.ip.prefix=24
virtual.ip.single=true
application.name=lin8
EOF

grep -E '^(db\.|bind\.address|is\.witness|ping\.server\.ip|auto\.allow|stable\.nodes|virtual\.ip|script\.notification|application\.name)' efm.properties

The most important properties at a glance:

PropertyMeaning
db.*How the agent connects to and controls the local database: user, port, database, service, owner, binaries and data directory.
bind.addressLocal address and port used for the communication between the agents. Different on every node.
is.witnesstrue only on the witness node. On a witness all db.* properties are ignored.
ping.server.ipAn address the agents ping to check their own network connection (here: the gateway).
auto.allow.hosts / stable.nodes.fileSimplify the start of a test cluster: all nodes listed in efm.nodes are allowed to join, and the file is not rewritten by EFM. For production, see the EFM documentation.
virtual.ip*The VIP, the interface and the prefix length. With virtual.ip.single=true the same VIP always moves to the new primary.
script.notificationScript that is called for every notification with subject and message. Check the comment in efm.properties.in for the exact argument placeholders.
application.nameUsed in primary_conninfo when this node is reconfigured as a standby.

4.5 efm.nodes

efm.nodes lists the addresses and ports of the cluster members. An agent needs at least one reachable member in this list to join the cluster:

# run as root on lin8
cat >> /etc/edb/efm-5.5/efm.nodes << 'EOF'
11.1.1.196:7800
11.1.1.195:7800
11.1.1.186:7800
EOF

4.6 Distribute the configuration to lin7 and lin6

The files can be identical on all nodes, except for bind.address, application.name and – on the witness – is.witness:

# run as root on lin8
for h in lin7 lin6; do
  scp -o StrictHostKeyChecking=accept-new /etc/edb/efm-5.5/efm.properties /etc/edb/efm-5.5/efm.nodes $h:/etc/edb/efm-5.5/
done
# run as root on lin7
cd /etc/edb/efm-5.5
sed -i 's|^bind.address=.*|bind.address=11.1.1.195:7800|; s|^application.name=.*|application.name=lin7|' efm.properties
chown efm:efm efm.nodes; chmod 600 efm.nodes
chown efm:enterprisedb efm.properties; chmod 640 efm.properties
# run as root on lin6
cd /etc/edb/efm-5.5
sed -i 's|^bind.address=.*|bind.address=11.1.1.186:7800|; s|^is.witness=.*|is.witness=true|; s|^application.name=.*|application.name=lin6|' efm.properties
chown efm:efm efm.properties efm.nodes; chmod 600 efm.properties efm.nodes

4.7 Test the virtual IP

Before starting EFM, the EFM documentation recommends testing the VIP manually with the efm_address script (as root, with EFM stopped). The VIP must not be reachable before and after the test:

# run on all nodes: the VIP must not answer (100% packet loss)
ping -c3 11.1.1.200
# run as root on lin8: add the VIP
/usr/edb/efm-5.5/bin/efm_address add4 enp0s3 11.1.1.200/24
ip -br addr show enp0s3
# run on lin7 and lin6: the VIP must answer now
ping -c3 11.1.1.200
# run as root on lin8: remove the VIP again
/usr/edb/efm-5.5/bin/efm_address del enp0s3 11.1.1.200/24
ip -br addr show enp0s3

Repeat the test on lin7 and make sure the VIP is removed from all nodes before starting EFM.

Sample Output from lin8 (click to expand):
[root@lin8 efm-5.5]# # run on all nodes: the VIP must not answer (100% packet loss)
ping -c3 11.1.1.200
PING 11.1.1.200 (11.1.1.200) 56(84) bytes of data.
From 11.1.1.196 icmp_seq=1 Destination Host Unreachable
From 11.1.1.196 icmp_seq=2 Destination Host Unreachable
From 11.1.1.196 icmp_seq=3 Destination Host Unreachable

--- 11.1.1.200 ping statistics ---
3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2075ms
pipe 3
[root@lin8 efm-5.5]# # run as root on lin8: add the VIP
/usr/edb/efm-5.5/bin/efm_address add4 enp0s3 11.1.1.200/24
ip -br addr show enp0s3
enp0s3           UP             11.1.1.196/24 11.1.1.200/24 fe80::a00:27ff:fe2e:2dd8/64
[root@lin8 efm-5.5]# # run on lin7 and lin6: the VIP must answer now
ping -c3 11.1.1.200
PING 11.1.1.200 (11.1.1.200) 56(84) bytes of data.
64 bytes from 11.1.1.200: icmp_seq=1 ttl=64 time=0.021 ms
64 bytes from 11.1.1.200: icmp_seq=2 ttl=64 time=0.039 ms
64 bytes from 11.1.1.200: icmp_seq=3 ttl=64 time=0.049 ms

--- 11.1.1.200 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2034ms
rtt min/avg/max/mdev = 0.021/0.036/0.049/0.011 ms
[root@lin8 efm-5.5]# # run as root on lin8: remove the VIP again
/usr/edb/efm-5.5/bin/efm_address del enp0s3 11.1.1.200/24
ip -br addr show enp0s3
enp0s3           UP             11.1.1.196/24 fe80::a00:27ff:fe2e:2dd8/64
[root@lin8 efm-5.5]#

4.8 Start the EFM cluster

The agents can be started in any order. We start with the primary and check the status after each node:

# run as root on lin8, then on lin7, then on lin6
systemctl enable --now edb-efm-5.5
/usr/edb/efm-5.5/bin/efm cluster-status efm
Cluster Status Output (click to expand):
[root@lin6 ~]# /usr/edb/efm-5.5/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Witness     11.1.1.186           N/A      11.1.1.200
        Standby     11.1.1.195           UP       11.1.1.200
        Primary     11.1.1.196           UP       11.1.1.200*

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.196

Standby priority host list:
        11.1.1.195

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     11.1.1.196                              0/5004138
        Standby     11.1.1.195           0/5004138          0/5004138

        Standby database(s) in sync with primary. It is safe to promote.
[root@lin6 ~]#

A healthy cluster shows the three agents (Primary, Standby, Witness), the VIP on lin8, lin7 in the standby priority list and the message Standby database(s) in sync with primary. If an agent does not start, journalctl -u edb-efm-5.5 and the log files in /var/log/efm-5.5 usually show the reason quickly (see Troubleshooting below).

Note on autostart: EFM recommends that the agent starts before the database, so that a rebooted old primary does not come up as a second primary. We will see why in test 3. For the lab we keep both services enabled; for production, review the autostart chapter of the EFM documentation and the property auto.resume.startup.period.

5. Prepare the Failover Tests

5.1 Test table

For the tests we write one row per second through the VIP into a small table. Each row records when it was written and which server accepted it, so after each test we can see the outage and that no committed row was lost:

# run as root on lin8
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
CREATE TABLE ha_test (
  id        serial PRIMARY KEY,
  ts        timestamp DEFAULT clock_timestamp(),
  served_by inet DEFAULT inet_server_addr()
);
EOF

5.2 Writer loop

The loop runs on the witness lin6, so it keeps running while the database nodes fail. A Postgres client from the RHEL repositories is sufficient. Every line is prefixed with the local time, so errors and the duration of the outage are easy to spot:

# run as root on lin6
dnf -y install postgresql

cat > /usr/local/bin/ha_writer.sh << 'EOF'
#!/bin/bash
export PGPASSWORD=changeme PGCONNECT_TIMEOUT=2
while true; do
  psql -h 11.1.1.200 -p 5444 -U enterprisedb -d edb -qAtX \
       -c "INSERT INTO ha_test DEFAULT VALUES RETURNING id, ts, served_by" 2>&1 \
  | sed "s/^/$(date +%T) /"
  sleep 1
done
EOF
chmod 755 /usr/local/bin/ha_writer.sh

During each test I use three terminals: the writer loop (/usr/local/bin/ha_writer.sh on lin6), the EFM events (journalctl -t efm-notify -f on lin6) and one for the test commands. After each test, the following queries show which node accepted the writes and the longest gap between two rows:

# run as root on the current primary
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
SELECT served_by, count(*), min(ts), max(ts)
FROM ha_test GROUP BY served_by ORDER BY min(ts);

SELECT max(gap) AS longest_outage
FROM (SELECT ts - lag(ts) OVER (ORDER BY ts) AS gap FROM ha_test) x;
EOF

Don’t be surprised by gaps in the id column after a failover: sequences are WAL-logged in steps of 32 values, so the new primary continues with a higher value. This is normal Postgres behavior and no data loss.

6. Failover Tests

Before each test, efm cluster-status efm must show a healthy cluster with the standby in sync. After the tests that remove the old primary, we rebuild it as a standby (chapter 6.6).

6.1 Test 1: Planned switchover

A switchover is the planned role change, e.g. for OS patching. EFM promotes the standby, moves the VIP and restarts the old primary as a standby of the new primary:

# run as root on any node
/usr/edb/efm-5.5/bin/efm promote efm -switchover
/usr/edb/efm-5.5/bin/efm cluster-status efm
Sample Output (click to expand):
[root@lin8 efm-5.5]# # run as root on any node
/usr/edb/efm-5.5/bin/efm promote efm -switchover
/usr/edb/efm-5.5/bin/efm cluster-status efm
Promote/switchover command accepted by local agent. Proceeding with promotion and will reconfigure original primary. Run the 'cluster-status' command for information about the new cluster state.
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Witness     11.1.1.186           N/A      11.1.1.200
        Standby     11.1.1.195           UP       11.1.1.200
        Idle        11.1.1.196           UNKNOWN  11.1.1.200

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.196

Standby priority host list:
        11.1.1.195

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     11.1.1.195                              0/5064000

        No standby databases were found.

Idle Node Status (idle nodes ignored in WAL LSN comparisons):

        Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------
        11.1.1.196           UNKNOWN            UNKNOWN            Connection to 11.1.1.196:5444 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
[root@lin8 efm-5.5]# /usr/edb/efm-5.5/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Witness     11.1.1.186           N/A      11.1.1.200
        Primary     11.1.1.195           UP       11.1.1.200*
        Standby     11.1.1.196           UP       11.1.1.200

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.196

Standby priority host list:
        11.1.1.196

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     11.1.1.195                              0/506EA20
        Standby     11.1.1.196           0/506EA20          0/506EA20

        Standby database(s) in sync with primary. It is safe to promote.
[root@lin8 efm-5.5]#

Expected: lin7 is the new primary, the VIP has moved to lin7, lin8 runs as a standby and the writer loop shows only a short interruption. Observed: 4 sec interruption. Running the same command again switches back to lin8.

6.2 Test 2: Database crash on the primary

We simulate a crash of the database while the server and the EFM agent keep running. An immediate shutdown stops Postgres without a checkpoint, just like a crash:

# run as root on lin8
su - enterprisedb -c '/usr/edb/as18/bin/pg_ctl -D /var/lib/edb/as18/data stop -m immediate'
Sample Output (click to expand):
[root@lin7 efm-5.5]# # run as root on the current primary
su - enterprisedb -c 'psql -d edb -v ON_ERROR_STOP=1' << 'EOF'
SELECT served_by, count(*), min(ts), max(ts)
FROM ha_test GROUP BY served_by ORDER BY min(ts);

SELECT max(gap) AS longest_outage
FROM (SELECT ts - lag(ts) OVER (ORDER BY ts) AS gap FROM ha_test) x;
EOF
 served_by  | count |            min            |            max
------------+-------+---------------------------+---------------------------
 11.1.1.200 |   481 | 24-NOV-26 14:25:10.060549 | 24-NOV-26 14:34:43.902668
(1 row)

 longest_outage
-----------------
 00:01:06.896183
(1 row)

[root@lin7 efm-5.5]# /usr/edb/efm-5.5/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Witness     11.1.1.186           N/A      11.1.1.200
        Primary     11.1.1.195           UP       11.1.1.200*
        Idle        11.1.1.196           UNKNOWN  11.1.1.200

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.196

Standby priority host list:
        (List is empty.)

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     11.1.1.195                              0/509DE68

        No standby databases were found.

Idle Node Status (idle nodes ignored in WAL LSN comparisons):

        Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------
        11.1.1.196           UNKNOWN            UNKNOWN            Connection to 11.1.1.196:5444 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
[root@lin7 efm-5.5]#

Expected: The agent on lin8 notices that its database no longer responds, tries to reconnect for local.timeout (60 seconds by default), and then EFM promotes lin7 and moves the VIP. EFM does not restart the failed database; lin8 has to be rebuilt as a standby (chapter 6.6). Observed: 1m7s interruption.

6.3 Test 3: Hard failure of the primary server

Now the whole primary server disappears. Power off the VM lin8 the hard way in VirtualBox (Close → Power off the machine in the GUI or VBoxManage controlvm lin8 poweroff on the host), not with a clean shutdown.

Sample Output (click to expand):
[root@lin7 efm-5.5]# /usr/edb/efm-5.5/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Witness     11.1.1.186           N/A      11.1.1.200
        Primary     11.1.1.195           UP       11.1.1.200*
        DOWN        11.1.1.196           N/A

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.195

Standby priority host list:
        (List is empty.)

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     11.1.1.195                              0/7015398

        No standby databases were found.
[root@lin7 efm-5.5]#

Expected: lin7 and lin6 miss the heartbeats of lin8; after node.timeout (50 seconds by default) they still form a majority (2 of 3 nodes), so lin7 is promoted and takes over the VIP.

Before you start lin8 again, remember the autostart note from chapter 4.8: if the database service starts on boot, the old primary comes up as a primary again – not reachable through the VIP, but reachable for any client that connects to lin8 directly. After the boot, check SELECT pg_is_in_recovery(); and efm cluster-status efm on lin8, stop its database and rebuild it as a standby.

6.4 Test 4: Witness down – why the third node matters

This test shows the quorum rules of EFM 5. First, power off the witness lin6 the hard way (run the writer loop on another machine for this test). The cluster keeps working, no failover happens. Then power off the primary lin8 as in test 3.

Expected: Since EFM 5.0, failed or disconnected nodes still count for the quorum. lin7 is alone with 1 of 3 nodes and therefore must not promote itself – from its point of view it could just as well be the isolated node. This is exactly the split-brain protection we want, and the reason why a two-node EFM cluster without a witness is not a good idea. Start lin6 and lin8 again afterwards and check the cluster status.

Sample Output (click to expand):
[root@lin7 ~]# /usr/edb/efm-5.5/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Standby     11.1.1.195           UP       11.1.1.200

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.195

Standby priority host list:
        11.1.1.195

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Standby     11.1.1.195           0/90319C0          0/90319C0

        No primary database was found.
[root@lin7 ~]#

Now we start lin6 and lin8 again:

Sample Output (click to expand):
[root@lin7 ~]# /usr/edb/efm-5.5/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Witness     11.1.1.186           N/A      11.1.1.200
        Standby     11.1.1.195           UP       11.1.1.200
        Primary     11.1.1.196           UP       11.1.1.200*

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.195

Standby priority host list:
        11.1.1.195

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     11.1.1.196                              0/9033A18
        Standby     11.1.1.195           0/9033A18          0/9033A18

        Standby database(s) in sync with primary. It is safe to promote.
[root@lin7 ~]#

6.5 Test 5: Network isolation of the primary

Finally, the primary loses its network connection while the server keeps running. Run the command on the console of the VM, not via SSH – you would lose your session:

# run as root on the console of lin8
ip link set enp0s3 down
# ... wait until the failover has happened, then
ip link set enp0s3 up
Sample Output (click to expand):
[root@lin7 ~]# /usr/edb/efm-5.5/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Witness     11.1.1.186           N/A      11.1.1.200
        Primary     11.1.1.195           UP       11.1.1.200*
        DOWN        11.1.1.196           N/A

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.195

Standby priority host list:
        (List is empty.)

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     11.1.1.195                              0/9033C60

        No standby databases were found.
[root@lin7 ~]#

Expected: lin7 and lin6 form the majority and promote lin7. The isolated agent on lin8 notices that it is cut off from the cluster and, with stop.isolated.primary=true (default), stops its database and releases the VIP, so we do not end up with two writable primaries.

6.6 Rebuild the old primary as a standby

After tests 2, 3 and 5, the old primary lin8 must be rebuilt as a standby of the new primary lin7. EFM 5 can do this with efm create-standby: it stops the local database, removes the data directory, runs pg_basebackup from the current primary, starts the standby and resumes monitoring. The local agent must be running. The option -prompt shows the planned steps and the generated pg_basebackup command before anything is changed.

Warning: This command deletes the data directory of the node it runs on. Check twice that you are on the old primary and that cluster-status shows lin7 as the current primary.

# run as root on lin8
systemctl start edb-efm-5.5           # if the agent is not running
/usr/edb/efm-5.5/bin/efm cluster-status efm
/usr/edb/efm-5.5/bin/efm create-standby efm -prompt
/usr/edb/efm-5.5/bin/efm cluster-status efm
Sample Output (click to expand):
[root@lin8 ~]# # run as root on lin8
systemctl start edb-efm-5.5           # if the agent is not running
/usr/edb/efm-5.5/bin/efm cluster-status efm
/usr/edb/efm-5.5/bin/efm create-standby efm -prompt
/usr/edb/efm-5.5/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Witness     11.1.1.186           N/A      11.1.1.200
        Primary     11.1.1.195           UP       11.1.1.200*
        Idle        11.1.1.196           UNKNOWN  11.1.1.200
        DOWN        11.1.1.196           N/A

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.195

Standby priority host list:
        (List is empty.)

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     11.1.1.195                              0/7020208

        No standby databases were found.

Idle Node Status (idle nodes ignored in WAL LSN comparisons):

        Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------
        11.1.1.196           UNKNOWN            UNKNOWN            Connection to 11.1.1.196:5444 refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
Found primary 11.1.1.195 from cluster status.
Verify primary address 11.1.1.195 does not match this agent's bind address '11.1.1.196' or external address ''.
Will signal local agent to run database stop command and become idle if not already.
Will remove the /var/lib/edb/as18/data/pg_wal and /var/lib/edb/as18/data directories, and run pg_basebackup using the following parameters:
-R -D /var/lib/edb/as18/data -X stream
...with connection string: host=11.1.1.195 port=5444 application_name=lin8

Do you want to continue? [y/N]:y
Signalling local agent to stop db and become idle if needed.
Removing directories/files and running pg_basebackup.
Starting database.
Waiting briefly for database to finish startup.
Attempting to resume local efm agent monitoring.
Resume command successful on local agent.
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Witness     11.1.1.186           N/A      11.1.1.200
        Primary     11.1.1.195           UP       11.1.1.200*
        Standby     11.1.1.196           UP       11.1.1.200

Allowed node host list:
        11.1.1.196 11.1.1.195 11.1.1.186

Membership coordinator: 11.1.1.195

Standby priority host list:
        11.1.1.196

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     11.1.1.195                              0/9000790
        Standby     11.1.1.196           0/9000790          0/9000790

        Standby database(s) in sync with primary. It is safe to promote.
[root@lin8 ~]#

For a lab database, a new base backup takes only seconds. For large databases, pg_rewind (we enabled wal_log_hints for it) is much faster; EFM can also use it automatically via the property auto.rewind. When lin8 is in sync again, a switchover (test 1) restores the original roles.

7. Test Results at a Glance

TestExpected resultOutage (observed)
1. Planned switchoverlin7 primary, lin8 standby, VIP on lin74 s
2. Database crash on primaryFailover to lin7 after local.timeout, lin8 fenced67 s
3. Primary server powered offFailover to lin7 after node.timeout (2 of 3 nodes)60 s
4. Witness down, then primary downNo promotion: lin7 has no quorum (1 of 3 nodes)no failover
5. Primary network isolatedFailover to lin7, isolated lin8 stops its database60 s

8. From the Lab to Production

The setup above is deliberately simple. Before using EFM in production, review at least these points:

  • Node authorization: set auto.allow.hosts=false and stable.nodes.file=false and allow nodes explicitly with efm allow-node.
  • Replication slots: use physical replication slots instead of wal_keep_size and let EFM synchronize them to the standbys with update.physical.slots.period, so the slots exist on a new primary after a failover.
  • Data loss: with asynchronous replication, the last transactions before a failover can be lost. If that is not acceptable, use synchronous replication with at least two standbys (see reconfigure.num.sync).
  • Timeouts: local.timeout and node.timeout determine how fast EFM reacts – and how quickly a short hiccup causes an unnecessary failover. Measure and tune them for your network.
  • Security: encrypt the agent communication (encrypt.agent.messages), use strong passwords and restrict pg_hba.conf to the necessary hosts.
  • Autostart: make sure a rebooted old primary cannot come up as a second primary.
  • Monitoring and notifications: real e-mail notifications or an integration into your monitoring, e.g. with Postgres Enterprise Manager (PEM).
  • Backups: high availability is no replacement for backups – a DROP TABLE is replicated to the standby within milliseconds.

Troubleshooting Common Issues

ProblemSolution
The EFM agent does not startCheck journalctl -u edb-efm-5.5 and the logs in /var/log/efm-5.5. Typical causes: missing Java 17+, wrong file permissions (efm.properties must be readable by efm and, on the database nodes, by enterprisedb – otherwise the start fails with Permission denied), typo in efm.properties.
“Database connection failure” in cluster-statusCheck db.user, the encrypted password, db.port, db.database and the pg_hba.conf entries for efm. Test with psql -h lin8 -p 5444 -U efm -d edb.
A node is not allowed to joinCheck efm.nodes, the firewall (port 7800) and the allowed host list in cluster-status. Allow the node with efm allow-node efm <address>.
The VIP is not assignedCheck interface name and prefix with ip -br addr and repeat the manual test with efm_address (chapter 4.7).
The standby is not promotableCheck the replication (pg_stat_replication) and the WAL positions in cluster-status. A standby that is not in sync is not promoted.
pg_basebackup fails with an authentication errorCheck ~/.pgpass of the enterprisedb user (permissions 600) and the replication entries in pg_hba.conf.

Ressources

Conclusion

Our single EPAS server is now a three node EFM cluster: lin8 as primary, lin7 as streaming replication standby and lin6 as witness. Here is a quick recap:

  • EFM needs at least three agents for a quorum – a witness node is the cheapest way to get there.
  • Clients connect through a VIP that EFM always moves to the current primary.
  • Switchover, database crash, server failure and network isolation are handled automatically; without quorum, EFM deliberately does not promote.
  • With efm create-standby an old primary is rebuilt as a standby with a single command.

Next Steps:

  • Put EDB PgBouncer in front of the cluster and let EFM re-point it after a failover (follow-up post).
  • Monitor the cluster with Postgres Enterprise Manager (PEM).
  • Set up backups with Barman.
0