Setting up a simple cluster

Once the installation has been done, it is time to get started and actually set up a simple cluster. In this scenario, a cluster consisting of three nodes will be created.

Note that all the data nodes will be on the same physical box in order to make life easier for beginners.

Arranging storage

The first thing administrators have to do is create some space for PostgreSQL. In this simplistic example, just three directories are created:

[root@localhost ~]# mkdir /data
[root@localhost ~]# mkdir /data/node1 /data/node2 /data/node3

Make sure that these directories belong to postgres (if PostgreSQL is really running as postgres, which is usually a good idea):

[root@localhost ~]# cd /data/
[root@localhost data]# chown postgres.postgres ...

Get PostgreSQL Replication - 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.