Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The setup consists of three PostgreSQL database servers:

primaryThe currently active database
standbyChanges on the primary node will be replicated to this node
witnessThe witness is not participating in the replication, but is used to prevent a split-brain situation

The repmgr daemon proces (repmgrd) monitors the primary node. When it is no longer reachable it will perform a fail-over, and promote the standby node to act as the primary. 

...

  1. Install the PostgreSQL software on the server (as root):
    dnf install postgresql15-server repmgr-15*
  2. Initialize the PostgreSQL instance (as root):
    /usr/pgsql-15/bin/postgresql-15-setup initdb 
  3. Enable and start the service (as root):
    systemctl enable --now postgresql-15.service 
  4. Setup repmgr
    1. Create the repmgr user and database as a superuser using psql (as user postgres):
      create user repmgr with superuser with password 'secret'; 
      create database repmgr with owner repmgr; 
    2. Edit the repmgr settings /etc/repmgr/15/repmgr.conf (as root):
      node_id=3 
      node_name=c-fews27231 
      conninfo='host=c-fews27231 user=repmgr dbname=repmgr connect_timeout=2' 
      data_directory='/var/lib/pgsql/15/data/' 
      Register the primary witness node (as user postgres):
      /usr/pgsql-15/bin/repmgr -f /etc/repmgr/15/repmgr.conf witness register -h c-fews19691 -F  
    3. Enable and start the service (as root):
      systemctl enable --now repmgr-15.service 

...