DBA Hub

📋Steps in this guide1/21

EDB failover manager (EFM) for managing streaming replication - DBACLASS DBACLASS

EDB failover manager(EFM) is used for managing postgres clusters with streaming replication. /usr/edb/efm-3.9/bin/efm cluster-status efm

postgresql configurationintermediate
by PostgreSQL
18 views
1

1. Update pg_hba.conf file on both primary and standby server

Add host entries for primary and standby server in pg_hba.conf file of both servers and reload the config.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     peer
# IPv4 local connections:
host    all             all             127.0.0.1/32           ident
host    all             all             10.20.30.40/32         md5
host    all             all             10.20.30.41/32         md5
host    all             all             10.20.30.42/32         md5

postgres=# select pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
2

1. Install efm package:

Code/Command (click line numbers to comment):

1
yum install edb-efm39
3

2. Encrypt db user password:

here we are using the db user enterprisedb for efm configuration.Make sure this user is a super user.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[enterprisedb@SCPrLBTB76 bin]$ <span style="color: #ff0000;"><strong>/usr/edb/efm-3.9/bin/efm encrypt efm</strong></span>
This utility will generate an encrypted password for you to place in your
EFM cluster property file: /etc/edb/efm-3.9/efm.properties

Please enter the password and hit enter: --- <span style="color: #ff0000;"><em><strong>Here put password of enterprisedb user</strong></em></span>

Please enter the password again to confirm:

The encrypted password is: <span style="color: #800000;"><strong>923dfba06cc8258dfd9c01de499e27ed</strong></span>

Please paste this into your efm.properties file
        db.password.encrypted=923dfba06cc8258dfd9c01de499e27ed


efm.properties file:
4

3. Copy and provide permission to property files:

Code/Command (click line numbers to comment):

1
2
3
4
5
root# cd /etc/edb/efm-3.9
root# cp efm.properties.in efm.properties
root# cp efm.nodes.in efm.nodes
root# chmod 666 efm.properties
root# chmod 666 efm.nodes
5

4. Update the efm.properties file:

> NOTE – > ping.server.ip can be any ip , which has connectivity to all ips. If you have connectivity to internet, then leave it to default value. For more information on properties file https://www.enterprisedb.com/edb-docs/d/edb-postgres-failover-manager/user-guides/user-guide/3.7/cluster_properties.html NOTE – > ping.server.ip can be any ip , which has connectivity to all ips. If you have connectivity to internet, then leave it to default value. For more information on properties file https://www.enterprisedb.com/edb-docs/d/edb-postgres-failover-manager/user-guides/user-guide/3.7/cluster_properties.html

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
db.user=enterprisedb
db.password.encrypted=<span style="color: #ff0000;"><strong>923dfba06cc8258dfd9c01de499e27ed</strong></span>
db.port=5432
db.database=edb
db.service.owner=enterprisedb
db.bin=/usr/edb/as11/bin
db.data.dir=/pgdata/edbdata
db.config.dir=/pgdata/edbdata
[email protected]
<strong><span style="color: #ff0000;">bind.address=10.20.30.40:7800
</span></strong>admin.port=8001
is.witness=false
<span style="color: #ff0000;"><strong>ping.server.ip</strong></span>=10.20.30.50 -- > all the nodes should be able to ping this server. 
efm.loglevel=TRACE
6

For more information on properties file

https://www.enterprisedb.com/edb-docs/d/edb-postgres-failover-manager/user-guides/user-guide/3.7/cluster_properties.html
7

5. start efm service:

Code/Command (click line numbers to comment):

1
systemctl start edb-efm-3.9
8

6. Add standby and witness node ip in allow-node list:

Code/Command (click line numbers to comment):

1
2
3
4
5
<span style="color: #ff0000;">
/usr/edb/efm-3.9/bin/efm allow-node efm 10.20.30.41</span>

<span style="color: #ff0000;">/usr/edb/efm-3.9/bin/efm allow-node efm 10.20.30.42
</span>
9

7. Check efm status:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
[root@dbhost40 efm-3.9]# <span style="color: #ff0000;"><strong>/usr/edb/efm-3.9/bin/efm cluster-status efm</strong></span>
Cluster Status: efm

        Agent Type  Address              Agent  DB       VIP
        -----------------------------------------------------------------------
        Master      10.20.30.40         UP     UP

Allowed node host list:
        10.20.30.40

Membership coordinator: 10.20.30.40

Standby priority host list:
        (List is empty.)

Promote Status:

        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Master      10.20.30.40                            0/F001AB8

        No standby databases were found.
10

1. Install efm package:

Code/Command (click line numbers to comment):

1
yum install edb-efm39
11

2. Copy and provide permission to property files:

Code/Command (click line numbers to comment):

1
2
3
4
5
root# cd /etc/edb/efm-3.9
root# cp efm.properties.in efm.properties
root# cp efm.nodes.in efm.nodes
root# chmod 666 efm.properties
root# chmod 666 efm.nodes
12

3. Update the efm.properties file:

Either you can update the efm.properties file directly , or copy the file from master node. The only change needed is the bind.address . rest are same as master node.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
db.user=enterprisedb
db.password.encrypted=923dfba06cc8258dfd9c01de499e27ed
db.port=5432
db.database=edb
db.service.owner=enterprisedb
db.bin=/usr/edb/as11/bin
db.data.dir=/pgdata/edbdata
db.config.dir=/pgdata/edbdata
[email protected]
<span style="color: #ff0000;"><strong>bind.address=10.20.30.41:7800
</strong></span>admin.port=8001
is.witness=false
ping.server.ip=10.20.30.50
efm.loglevel=TRACE
13

4. Update the efm.nodes file :

Add the primary node ip and witness node ip:

Code/Command (click line numbers to comment):

1
2
3
4
5
[root@dbhost41 efm-3.9]# <span style="color: #ff0000;"><strong>cat efm.nodes</strong></span>
# List of node address:port combinations separated by whitespace.
# The list should include at least the membership coordinator's address.

10.20.30.40:7800 10.20.30.42:7800
14

5. Start efm service:

Code/Command (click line numbers to comment):

1
systemctl start edb-efm-3.9
15

6. Check the cluster status:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
[root@dbhost41 ~]$ <span style="color: #ff0000;"><strong>/usr/edb/efm-3.9/bin/efm cluster-status efm</strong></span>
Cluster Status: efm

        Agent Type  Address              Agent  DB       VIP
 -----------------------------------------------------------------------
       Master         10.20.30.40         UP     UP
       Standby        10.20.30.41         UP    UP

Allowed node host list:
10.20.30.40 10.20.30.41

Membership coordinator: 10.20.30.40

Standby priority host list:
10.20.30.41

Promote Status:
        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Master      10.20.30.40                            0/F001AB8
        Standby     10.20.30.41           0/F000000.       0/F001AB8


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

1. Install efm package:

Code/Command (click line numbers to comment):

1
yum install edb-efm39
17

2. Copy and provide permission to property files.

Code/Command (click line numbers to comment):

1
2
3
4
5
root# cd /etc/edb/efm-3.9
root# cp efm.properties.in efm.properties
root# cp efm.nodes.in efm.nodes
root# chmod 666 efm.properties
root# chmod 666 efm.nodes
18

3. Update efm.properties file:

Either you can update the efm.properties file directly , or copy the file from master node. The only change needed is the bind.address and is.witness =true. Rest are same as master node.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
db.user=enterprisedb
db.password.encrypted=923dfba06cc8258dfd9c01de499e27ed
db.port=5432
db.database=edb
db.service.owner=enterprisedb
db.bin=/usr/edb/as11/bin
db.data.dir=/pgdata/edbdata
db.config.dir=/pgdata/edbdata
[email protected]
<span style="color: #ff0000;"><strong>bind.address=10.20.30.42:7800
</strong></span>admin.port=8001
<span style="color: #ff0000;"><strong>is.witness=true
</strong></span>ping.server.ip=10.21.172.21
efm.loglevel=TRACE
19

4. Add primary node and standby node ips :

Code/Command (click line numbers to comment):

1
2
3
4
[root@dbhost42 efm-3.9]# <span style="color: #ff0000;"><strong>cat efm.nodes</strong></span>
# List of node address:port combinations separated by whitespace.
# The list should include at least the membership coordinator's address.
10.20.30.40:7800 10.20.30.41:7800
20

5. Start efm services:

Code/Command (click line numbers to comment):

1
systemctl start edb-efm-3.9
21

6. Check cluster status:

With this our EFM setup completed . In the next article, we will explain different switchover and failover scenarios.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
[root@dbhost42 ~]$ <span style="color: #ff0000;"><strong>/usr/edb/efm-3.9/bin/efm cluster-status efm</strong></span>
Cluster Status: efm

        Agent Type  Address              Agent  DB       VIP
 -----------------------------------------------------------------------
       Master         10.20.30.40         UP     UP
       Standby        10.20.30.41         UP     UP
       Witness        10.20.30.42         UP     N/A

Allowed node host list:
10.20.30.40 10.20.30.41 10.20.30.42

Membership coordinator: 10.20.30.40

Standby priority host list:
10.20.30.41

Promote Status:
        DB Type     Address              WAL Received LSN   WAL Replayed LSN   Info
        ---------------------------------------------------------------------------
        Master      10.20.30.40                            0/F001AB8
        Standby     10.20.30.41           0/F000000.       0/F001AB8


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

Comments (0)

Please to add comments

No comments yet. Be the first to comment!