How to do it...

For this recipe, we will use the same two PostgreSQL nodes: pg1 and pg2. We will also continue to assume that our PostgreSQL data is located at /db/pgdata.

On Red-Hat-based systems, follow these steps on both servers as a root-capable user:

  1. Prevent the PostgreSQL service from starting automatically with this command:
        sudo chkconfig postgresql off
  1. Do the same for the DRBD service with this command:
        sudo chkconfig drbd off
  1. Create a file named /etc/sysconfig/postgresql with the following line:
        PGDATA=/db/pgdata 

On Debian-based systems, follow these steps on both servers as a root-capable user:

  1. Prevent the PostgreSQL service from starting automatically with this command:
        sudo update-rc.d postgresql disable
  1. Do ...

Get PostgreSQL High Availability Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.