Chapter 15. BDR failover with repmgrd

Table of Contents

15.1. Prerequisites
15.2. Configuration
15.3. repmgr setup
15.4. Defining the BDR failover "event_notification_command"
15.5. Node monitoring and failover
15.6. Node recovery
15.7. Shutdown of both nodes

repmgr 4.x provides support for monitoring a pair of BDR 2.x 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.

Note

This repmgr functionality is for BDR 2.x only running on PostgreSQL 9.4/9.6. It is not required for later BDR versions.