EDB Postgres Failover Manager (EFM) supports multiple ways to connect applications with the new master database after a failover or promotion. In many cases, a virtual IP address (VIP) can be used, and Failover Manager will move the VIP as needed. On cloud providers where the VIP is not an option, script hooks can be used to move a resource (e.g. an Elastic IP Address on AWS) to the new master node. With pgPool and other load balancers, additional script hooks can be used for updating the balancer configuration. However, not all failure cases could be handled by the existing options.
In EFM v3.2, we have added two new hooks that will allow more general load balancer operations. The two properties use the pgPool terms “attach” and “detach” for adding/removing a node from the load balancer configuration:
# Absolute path to load balancer scripts
# The attach script is called when a node should be attached to the load
# balancer, for example after a promotion. The detach script is called
# when a node should be removed, for example when a database has failed
# or is about to be stopped. Use %h to represent the IP/hostname
# of the node that is being attached/detached.
# script.load.balancer.attach=/somepath/attachscript %h
With these two hooks, it will be easier to support cases like switchover, standby failure, and master failure that does not end with a promotion (e.g. when the cluster is already at the minimum number of standbys if set).
The “detach” hook will be called in the following cases:
In summary, any condition that would cause a master or standby agent to enter ‘IDLE’ mode, or if the rest of the cluster sees a node disappear, will call the ‘detach’ script hook.
The “attach” hook will be called in these cases:
In summary, any condition that would cause an ‘IDLE’ or promoting agent to become a master or standby agent will call the ‘attach’ script hook.
For example, consider a node running on address 184.108.40.206 with the following set:
If the database on that node dies, the following would be run as the user running Failover Manager (typically the ‘efm’ user), passing in the IP address of the database node that should be removed from the load balancer configuration:
A single script could also be used:
script.load.balancer.attach=/somepath/lb_script.sh attach %h
script.load.balancer.detach=/somepath/lb_script.sh detach %h
In the same case as above, the following would be run as the failover manager user, where ‘detach’ and ‘220.127.116.11’ are the two parameters passed to the script:
/somepath/lb_script.sh detach 18.104.22.168
If a node fails, then another node would call its local detach script as above, passing in the address of the failed node. This is why it is important to specify scripts on every node, including witness nodes, if using the new load balancer hooks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.