How to do it...

For this recipe, we will need at least three PostgreSQL servers. For demonstration purposes, we'll assume they are named pg1, pg2, and pg3. Follow these steps on all three servers except where indicated:

  1. Extract the files in the etcd binary distribution and install the necessary files with the following commands as a root-capable user:
        tar -xzf etcd-v3.0.14-linux-amd64.tar.gz
        sudo cp etcd-3.0.14-linux-amd64/etcd* /usr/local/bin
  1. Create a storage directory for etcd with these commands as a root-level user:
        sudo mkdir /db/etcd
        sudo chown postgres:postgres /db/etcd
  1. Create a file named /etc/etcd.conf on the pg1 server with these contents:
 name: pg1 data-dir: /db/etcd initial-advertise-peer-urls: http://pg1:2380 listen-peer-urls: ...

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.