Chapter 20. BDR failover with repmgrd

Table of Contents
20.1. Prerequisites
20.2. Configuration
20.3. repmgr setup
20.4. Defining the BDR failover "event_notification_command"
20.5. Node monitoring and failover
20.6. Node recovery
20.7. Shutdown of both nodes

repmgr 4.x provides support for monitoring BDR nodes and taking action in case one of the nodes fails.

Note: Due to the nature of BDR 1.x/2.x, it's only safe to use this solution for a two-node scenario. Introducing additional nodes will create an inherent risk of node desynchronisation if a node goes down without being cleanly removed from the cluster.

In contrast to streaming replication, there's no concept of "promoting" a new primary node with BDR. Instead, "failover" involves monitoring both nodes with repmgrd and redirecting queries from the failed node to the remaining active node. This can be done by using an event notification script which is called by repmgrd to dynamically reconfigure a proxy server/connection pooler such as PgBouncer.