Checking the replication

If all nodes are up and running, we can already run our first operations on the cluster. In our example, we will simply connect to pgpool and create a new database. The createdb tool is a command-line tool that serves as abstraction for the CREATE DATABASE command, which can be replicated by pgpool nicely. In our example, we simply create a database called xy to see if replication works:

$ createdb xy -p 9999

To see if the command has been replicated as expected, we suggest connecting to both databases and seeing if the new database is present or not. In our example, everything has been working as expected:

$ psql xy -p 5433 -c "SELECT 1 AS x"
x
---
 1
(1 row)

Doing this basic check is highly recommended to make sure that ...

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.