In this article, I will tell you about the Download EDB Failover Manager.
The EFM cluster consists of:
1. An active primary server where transactions take place.
2. One or more standby databases.
3. Witness server assists efm cluster in decision making during primary or standby failover scenario.
However, if there is more than one standby node, the witness server is not required.
If you have not done the EDB installation and standby installation before, you can perform the installations by following the links below.
EDB PostgreSQL Installation:
1 |
https://dbtut.com/index.php/2022/03/22/edb-postgres-13-installation-on-oracle-linux-7-8/ |
EDB Standby Setup:
1 |
https://dbtut.com/index.php/2022/04/27/creating-a-hot-standby-in-edb-postgresql/ |
ENVIRONMENT DETAILS:
PRIMARY DB SERVER : 192.168.1.130
STANDBY DB SERVER : 192.168.1.14
WITNESS SERVER : 192.168.1.20
For the cluster structure, three servers must communicate with each other.
To Do On Primary Server
1. We add the following lines to the pg_hba.conf file and then restart the service.
1 2 3 4 5 6 |
$ vi /var/lib/edb/as13/data/pg_hba.conf #for efm host all all 192.168.1.130/32 md5 host all all 192.168.1.14/32 md5 host all all 192.168.1.20/32 md5 $[root@testdb]# systemctl restart edb-as-13 |
2. We load EFM.
1 |
[root@testdb ~]# yum install edb-efm42 |
3. The database user’s password is encrypted. Since I will be using the enterprisedb user, I will write his password.
1 2 3 4 5 6 7 8 9 10 11 12 |
-bash-4.2$ /usr/edb/efm-4.2/bin/efm encrypt efm This utility will generate an encrypted password for you to place in your EFM cluster property file: /etc/edb/efm-4.2/efm.properties Please enter the password and hit enter: --Enter the enterprisedb user password. Please enter the password again to confirm: The encrypted password is: bc3ebd41e84e67787877b16bdfeae3f5 Please paste this into your efm.properties file db.password.encrypted=bc3ebd41e84e67787877b16bdfeae3f5 |
4. We copy files and grant necessary authorizations.
1 2 3 4 5 |
[root@testdb ~]# cd /etc/edb/efm-4.2 [root@testdb efm-4.2]# cp efm.properties.in efm.properties [root@testdb efm-4.2]# cp efm.nodes.in efm.nodes [root@testdb efm-4.2]# chmod 666 efm.properties [root@testdb efm-4.2]# chmod 666 efm.nodes |
5. The efm.properties file is updated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@testdb efm-4.2]# vi efm.properties db.user=enterprisedb db.password.encrypted=bc3ebd41e84e67787877b16bdfeae3f5 db.port=5444 db.database=edb db.service.owner=enterprisedb db.service.name= db.bin=/usr/edb/as13/bin db.data.dir=/var/lib/edb/as13/data db.config.dir=/var/lib/edb/as13/data user.email=<mail> bind.address=192.168.1.130:7800 admin.port=7809 is.witness=false ping.server.ip=192.168.1.20 efm.loglevel=INFO |
6. We start the EFM service.
1 |
[root@testdb]# systemctl start edb-efm-4.2.service |
7. We add Allow node to standby and witness strings.
1 2 |
[root@testdb]# /usr/edb/efm-4.2/bin/efm allow-node efm 192.168.1.14 [root@testdb]# /usr/edb/efm-4.2/bin/efm allow-node efm 192.168.1.20 |
8. We enter the standby and witness server ips in the efm.nodes file.
1 2 3 4 |
[root@testdb efm-4.2]# vi efm.nodes # List of node address:port combinations separated by whitespace. # The list should include at least the membership coordinator s address. 192.168.1.20:7800 192.168.1.14:7800 |
To Do On Standby Server
1. We add the following lines to the pg_hba.conf file and then restart the service.
1 2 3 4 5 6 |
$ vi /var/lib/edb/as13/data/pg_hba.conf #for efm host all all 192.168.1.130/32 md5 host all all 192.168.1.14/32 md5 host all all 192.168.1.20/32 md5 $[root@testdb]# systemctl restart edb-as-13 |
2. We load EFM.
1 |
[root@testdb ~]# yum install edb-efm42 |
3. We copy files and grant necessary authorizations.
1 2 3 4 5 |
[root@testdb ~]# cd /etc/edb/efm-4.2 [root@testdb efm-4.2]# cp efm.properties.in efm.properties [root@testdb efm-4.2]# cp efm.nodes.in efm.nodes [root@testdb efm-4.2]# chmod 666 efm.properties [root@testdb efm-4.2]# chmod 666 efm.nodes |
4. We update the efm.properties file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@testdb efm-4.2]# vi efm.properties db.user=enterprisedb db.password.encrypted=bc3ebd41e84e67787877b16bdfeae3f5 db.port=5444 db.database=edb db.service.owner=enterprisedb db.service.name= db.bin=/usr/edb/as13/bin db.data.dir=/var/lib/edb/as13/data db.config.dir=/var/lib/edb/as13/data user.email=<mail> bind.address=192.168.1.14:7800 admin.port=7809 is.witness=false ping.server.ip=192.168.1.20 efm.loglevel=INFO |
5. We enter the primary and witness server ips in the efm.nodes file.
1 2 3 4 |
[root@testdb efm-4.2]# vi efm.nodes # List of node address:port combinations separated by whitespace. # The list should include at least the membership coordinator s address. 192.168.1.20:7800 192.168.1.130:7800 |
6. We start the EFM service.
1 |
[root@testdb]# systemctl start edb-efm-4.2.service |
What To Do On The Witness Server
1. Add the following lines to the pg_hba.conf file and then restart the service.
1 2 3 4 5 6 |
$ vi /var/lib/edb/as13/data/pg_hba.conf #for efm host all all 192.168.1.130/32 md5 host all all 192.168.1.14/32 md5 host all all 192.168.1.20/32 md5 $[root@testdb]# systemctl restart edb-as-13 |
2. We load EFM.
1 |
[root@testdb ~]# yum install edb-efm42 |
3. We copy files and grant necessary authorizations.
1 2 3 4 5 |
[root@testdb ~]# cd /etc/edb/efm-4.2 [root@testdb efm-4.2]# cp efm.properties.in efm.properties [root@testdb efm-4.2]# cp efm.nodes.in efm.nodes [root@testdb efm-4.2]# chmod 666 efm.properties [root@testdb efm-4.2]# chmod 666 efm.nodes |
4. We update the efm.properties file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
[root@testdb efm-4.2]# vi efm.properties db.user=enterprisedb db.password.encrypted=bc3ebd41e84e67787877b16bdfeae3f5 db.port=5444 db.database=edb db.service.owner=enterprisedb db.service.name= db.bin=/usr/edb/as13/bin db.data.dir=/var/lib/edb/as13/data db.config.dir=/var/lib/edb/as13/data user.email=<mail> bind.address=192.168.1.20:7800 admin.port=7809 is.witness=true ping.server.ip=192.168.1.20 efm.loglevel=INFO |
5. We enter the primary and standby server IPs in the efm.nodes file.
1 2 3 4 |
[root@testdb efm-4.2]# vi efm.nodes # List of node address:port combinations separated by whitespace. # The list should include at least the membership coordinator s address. 192.168.1.130:7800 192.168.1.14:7800 |
6. We start the EFM service.
1 |
[root@testdb]# systemctl start edb-efm-4.2.service |
After the necessary steps are taken on all three servers, we check the EFM service status with the following command.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
[root@testdb]# /usr/edb/efm-4.2/bin/efm cluster-status efm Cluster Status: efm Agent Type Address DB VIP ---------------------------------------------------------------- Primary 192.168.1.130 UP Standby 192.168.1.14 UP Witness 192.168.1.20 N/A Allowed node host list: 192.168.1.130 192.168.1.14 192.168.1.20 Membership coordinator: 192.168.1.130 Standby priority host list: 192.168.1.14 Promote Status: DB Type Address WAL Received LSN WAL Replayed LSN Info -------------------------------------------------------------------- Primary 192.168.1.130 0/100001C0 Standby 192.168.1.14 0/10000000 0/100001C0 Standby database(s) in sync with primary. It is safe to promote. |
I hope it has been a useful document for you.