How to do it...

For this recipe, we have two PostgreSQL nodes: pg1 and pg2, which are assigned IP addresses in the 192.168.56.0 subnet. Follow these steps as a root-capable user:

  1. On pg1, run this command to generate an authorization key file:
        corosync-keygen
  1. Open another connection to pg1 and perform several activities to generate sufficient entropy until corosync-keygen completes. A good source of random events is software compilation, for example.
  2. Copy the resulting /etc/corosync/authkey file to pg2. Make sure it is copied to /etc/corosync/authkey on pg1 as well.
  3. Modify the bindnetaddr, crypto_cipher, and crypto_hash lines in the /etc/corosync/corosync.conf file on both pg1 and pg2 so that it contains the following values:
 bindnetaddr: ...

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.