Steps by Step Configuration of EFM-4.2 in RHEL 8

This is the step by step documents to install and configure Enterprisedb Failover Manager (EFM) 4.2 in RHEL 8 #EDB #EFM #postgrsql



1- Prerequisite :


- EDB v12 is installed in the primary and master server 
- Replication is ongoing 
- All the servers are reachable from each other 
- Ports are open  
- Make sure Java is installed 


2- Here there will be 3 servers/nodes in the setup


    Master Node (node1) - 10.10.20.1 
    Standby Node (node2)- 10.10.20.2
    Witness Node (node3) - 10.10.20.3
    VIP - 10.10.20.5
    


3- Update pg_hba.conf file on both primary and standby server with the information of the replication and witness servers and reload it .



host    all             all             10.10.20.1/32           md5
host    all             all             10.10.20.2/32           md5
host    all             all             10.10.20.3/32           md5


[enterprisedb@node1 ~]$ psql

psql (12.10.14)

Type "help" for help.


edb=# select pg_reload_conf();

pg_reload_conf

----------------

t

(1 row)



[enterprisedb@node2~]$ psql

psql (12.10.14)

Type "help" for help.


edb=# select pg_reload_conf();

pg_reload_conf

----------------

t

(1 row)


4- Install EFM binary in all Master ,Standby and witness server



  • Create the repository configuration file

[root@node1 yum.repos.d]#

dnf -y install https://yum.enterprisedb.com/edbrepos/edb-repo-latest.noarch.rpm


O/p -

Updating Subscription Management repositories.
Last metadata expiration check: 0:37:25 ago on Thu 21 Apr 2022 04:15:03 PM +08.
[MIRROR] edb-repo-latest.noarch.rpm: Curl error (60): Peer certificate cannot be authenticated with given CA certificates for https://yum.enterprisedb.com/edbrepos/edb-repo-latest.noarch.rpm [SSL certificate problem: unable to get local issuer certificate]
edb-repo-latest.noarch.rpm                                                                                                  625  B/s | 6.3 kB     00:10
Dependencies resolved.
=============================================================================================================================================================
 Package                              Architecture                       Version                          Repository                                 Size
=============================================================================================================================================================
Installing:
 edb-repo                              noarch                              20-3                              @commandline                              6.3 k
Transaction Summary
=============================================================================================================================================================
Install  1 Package
Total size: 6.3 k
Installed size: 2.2 k
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                    1/1
  Installing       : edb-repo-20-3.noarch                                                                                                                1/1
  Running scriptlet: edb-repo-20-3.noarch                                                                                                               1/1
  Verifying        : edb-repo-20-3.noarch                                                                                                               1/1
Installed products updated.
Installed:
  edb-repo-20-3.noarch
Complete!  
  • Replace ‘USERNAME:PASSWORD’ below with your username and password for the EDB repositories


sed -i "s@<username>:<password>@USERNAME:PASSWORD@" /etc/yum.repos.d/edb.repo
  • Install the EPEL repository:


[root@node1 yum.repos.d]# dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

  • Install EFM package

[root@node1 ~]# dnf -y install edb-efm42


o/p:


Updating Subscription Management repositories.
Last metadata expiration check: 2:09:47 ago on Wed 27 Apr 2022 06:20:10 PM +08.
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Module yaml error: Unexpected key in data: static_context [line 9 col 3]
Dependencies resolved.
=============================================================================================================================================================
 Package                               Architecture                       Version                                   Repository                        Size
=============================================================================================================================================================
Installing:
 edb-efm42                              x86_64                              4.2-1.rhel8                               edb                              5.6 M

Transaction Summary
=============================================================================================================================================================
Install  1 Package

Total download size: 5.6 M
Installed size: 6.2 M
Downloading Packages:
edb-efm42-4.2-1.rhel8.x86_64.rpm                                                                                            1.5 MB/s | 5.6 MB     00:03
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                       1.5 MB/s | 5.6 MB     00:03

EnterpriseDB RPMs 8 - x86_64                                                                                                1.7 MB/s | 1.7 kB     00:00

Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                    1/1
  Running scriptlet: edb-efm42-4.2-1.rhel8.x86_64                                                                                                       1/1
  Installing       : edb-efm42-4.2-1.rhel8.x86_64                                                                                                       1/1
  Running scriptlet: edb-efm42-4.2-1.rhel8.x86_64                                                                                                       1/1
  Verifying        : edb-efm42-4.2-1.rhel8.x86_64                                                                                                       1/1
Installed products updated.

Installed:
  edb-efm42-4.2-1.rhel8.x86_64

Complete!

4-Do the EFM binary installation in standby and witness server as well .


5-Now configure EFM .

Master Node Configuration :

  • Create separate user for EFM


 edb=# create user efm with password 'pwd123' superuser ;
      CREATE ROLE

  [enterprisedb@node1 ~]$ psql -U efm
   Password for user efm:
   psql (12.10.14)
   Type "help" for help.
 edb=# exit 

  • After completing the Failover Manager installation, make a working copy of the template before modifying the file contents and change the ownership


     [root@node1 edb]# cd /etc/edb/efm-4.2/
	[root@node1 efm-4.2]#

	 [root@node1  efm-4.2]# ls -lrt
		total 32
		-rw-r--r--. 1 root root 27859 Mar 19  2021 efm.properties.in
		-rw-r--r--. 1 root root   139 Mar 19 2021 efm.nodes.in

	 [root@node1 efm-4.2]# cp efm.properties.in  efm.properties
	 [root@node1 efm-4.2]# cp efm.nodes.in  efm.nodes

	 [root@nde1 efm-4.2]# chown efm:efm efm.properties
	 [root@node1 efm-4.2]# chown efm:efm efm.nodes


  • Encrypt password of efm user


[enterprisedb@node1 efm-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:

          Please enter the password again to confirm:

         The encrypted password is: cn3zba41e84d67787834c16bdfeae3f5

            Please paste this into your efm.properties file
        db.password.encrypted=cn3zba41e84d67787834c16bdfeae3f5
  • Make changes to efm.properties file


db.user=efm
db.password.encrypted=cn3zba41e84d67787834c16bdfeae3f5
db.port=5460
db.database=edb
db.service.owner=enterprisedb
db.service.name= edb-as-12
db.bin=/usr/edb/as12/bin/
db.data.dir=/test_data
db.config.dir=/test_data
bind.address=10.10.20.1:7800
is.witness=false
ping.server.ip=10.10.20.4
auto.allow.hosts=true
virtualIp=10.10.20.5
virtualIp.interface=eth0
virtualIp.prefix=24
virtualIp.single=true

  • Add nodes entries in efm.nodes


[root@node1 efm-4.2]# cat efm.nodes
# List of node address:port combinations separated by whitespace.
# The list should include at least the membership coordinator's address.

10.10.20.1:7800
10.10.20.2:7800
10.10.20.3:7800
  • Stop the master database as pg_ctl and start using the service edb-as-12


[enterprisedb@node1 ~]$ pg_ctl stop
waiting for server to shut down.... done
server stopped
[enterprisedb@node1 ~]$

[enterprisedb@node1 ~]$# service edb-as-12 start
Redirecting to /bin/systemctl start edb-as-12.service
  • Now start the efm in master node


[root@node1 ~]# systemctl start edb-efm-4.2
[root@node1 ~]#

[root@node1 ~]# /usr/edb/efm-4.2/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
       ----------------------------------------------------------------
       Primary     10.10.20.1          UP         10.10.20.5

Allowed node host list:
        10.10.20.1  10.10.20.2  10.10.20.3

Membership coordinator:  10.10.20.1 

Standby priority host list:
        (List is empty.)

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
       ---------------------------------------------------------------------------
        Primary      10.10.20.1                               0/3F009E98

       No standby databases were found.


Standby Node Configuration

1- Repeat step 4 for standby EFM binary installation .

2-Configuraton :

Post binary installation in standby node do the below steps :


- Copy the properties file from master node to standby node


     [enterprisedb@node1 ~] cd /etc/edb/efm-4.2  
     [enterprisedb@node1 ~] scp efm.properties enterprisedb@node2:/etc/edb/efm-4.2  
     [enterprisedb@node1 ~] scp efm.nodes  enterprisedb@node2:/etc/edb/efm-4.2

      [enterprisedb@node2 ~] ls -lrt  
       -rw-r--r--. 1 root root 27859 Mar 19  2021 efm.properties.in
      -rw-r--r--. 1 root root   139 Mar 19 2021 efm.nodes.in 
      -rw-r--r--. 1 root root 27859 Mar 19  2021 efm.properties
      -rw-r--r--. 1 root root   139 Mar 19 2021 efm.nodes
      
      [enterprisedb@node2 ~]chown efm:efm efm.properties
      [enterprisedb@node2 ~]chown efm:efm efm.nodes
  

-Make changes to efm.properties file

Keep everything as it is except the bind.address .

Update it to the node ip of the standby server(Node2) .


db.user=efm
db.password.encrypted=cn3zba41e84d67787834c16bdfeae3f5
db.port=5460
db.database=edb
db.service.owner=enterprisedb
db.service.name= edb-as-12
db.bin=/usr/edb/as12/bin/
db.data.dir=/test_data
db.config.dir=/test_data
bind.address=10.10.20.2:7800
is.witness=false
ping.server.ip=10.10.20.4
auto.allow.hosts=true
virtualIp=10.10.20.5
virtualIp.interface=eth0
virtualIp.prefix=24
virtualIp.single=true


- Now start efm


[root@node2 efm-4.2]# systemctl start edb-efm-4.2
[root@node2 efm-4.2]#
[root@node2 efm-4.2]#
[root@node2 efm-4.2]# /usr/edb/efm-4.2/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Primary     10.10.20.1           UP        10.10.20.5*
        Standby     10.10.20.2           UP        10.10.20.5

Allowed node host list:
        10.10.20.1 10.10.20.2 10.10.20.3

Membership coordinator: 10.10.20.1

Standby priority host list:
        10.10.20.2

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     10.10.20.1                              0/3F05C020
        Standby     10.10.20.2           0/3F05C020         0/3F05C020

        Standby database(s) in sync with primary. It is safe to promote.

Witness Node Configuration


1- Repeat step 4 for witness EFM binary installation .

2-Configuraton :

Post binary installation in witness node do the below steps :


- Copy the properties file from master node to witness node


[enterprisedb@node1 ~] cd /etc/edb/efm-4.2  
[enterprisedb@node1 ~] scp efm.properties enterprisedb@node3:/etc/edb/efm-4.2  
[enterprisedb@node1 ~] scp efm.nodes enterprisedb@node2:/etc/edb/efm-4.2
[enterprisedb@node3 ~] ls -lrt  
       -rw-r--r--. 1 root root 27859 Mar 19  2021 efm.properties.in
      -rw-r--r--. 1 root root   139 Mar 19 2021 efm.nodes.in 
      -rw-r--r--. 1 root root 27859 Mar 19  2021 efm.properties
      -rw-r--r--. 1 root root   139 Mar 19 2021 efm.nodes
[root@node3]# chown efm:efm efm.nodes
[root@node3]# chown efm:efm efm.properties  
      

- Make changes to efm.properties file

Here the bind address as well as the witness parameter will be updated .



db.user=efm
db.password.encrypted=cn3zba41e84d67787834c16bdfeae3f5
db.port=5460
db.database=edb
db.service.owner=enterprisedb
db.service.name= edb-as-12
db.bin=/usr/edb/as12/bin/
db.data.dir=/test_data
db.config.dir=/test_data
bind.address=10.10.20.3:7800
is.witness=true 
ping.server.ip=10.10.20.4
auto.allow.hosts=true
virtualIp=10.10.20.5
virtualIp.interface=eth0
virtualIp.prefix=24
virtualIp.single=true




- Now start efm



   [root@node3 efm-4.2]# systemctl start edb-efm-4.2
   [root@node3 efm-4.2]# /usr/edb/efm-4.2/bin/efm cluster-status efm
Cluster Status: efm

        Agent Type  Address              DB       VIP
        ----------------------------------------------------------------
        Primary     10.10.20.1           UP        10.10.20.5*
        Standby     10.10.20.2           UP        10.10.20.5
         Witness     10.10.20.3           NA        10.10.20.5
Allowed node host list:
        10.10.20.1 10.10.20.2 10.10.20.3

Membership coordinator: 10.10.20.1

Standby priority host list:
        10.10.20.2

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Primary     10.10.20.1                              0/3F05C020
        Standby     10.10.20.2           0/3F05C020         0/3F05C020

        Standby database(s) in sync with primary. It is safe to promote.



105 views0 comments

Recent Posts

See All