Announcing the release of v1.0 of pg_cirrus - Hassle-free PostgreSQL cluster set up

Posted on 2023-09-25 by Stormatics
Related Open Source

We are pleased to announce the General Availability of pg_cirrus 1.0. This automated tool streamlines the process of setting up a 3-node cluster, making it significantly easier for users to set up and manage high availability in PostgreSQL.

We understand that configuring a PostgreSQL cluster can be a complex and time-consuming task, which is why we have designed pg_cirrus to help make the process faster and more efficient.

Key Features

Configuration Management

We've streamlined configuration management with a Python wrapper script that executes ansible playbooks for primary, standby, and pgpool nodes. Inventory and variable files are dynamically generated at runtime. Furthermore, pg_cirrus can set up PostgreSQL database servers on ports other than the default 5432.

Load Balancing

We have ensured proper load balancing within the PostgreSQL cluster using pgpool i.e. WRITE requests go to the primary PostgreSQL server and READ requests go to standby PostgreSQL servers.

Auto Failover

If the primary node fails, one of the standby nodes is automatically promoted as the new primary. If the newly promoted primary node also fails, the third node is promoted to handle both READ and WRITE requests.

User Experience

For a better user experience, pg_cirrus has a Command Line Interface to take configuration details from the user at run time. We have also provided the user with conf.yml.in, vault.yml.in and inventory.in template files. Users can also view pgpool logs saved in /var/log/pgpool_logs. To avoid invalid inputs, exception handling has been used in pg_cirrus. If pg_cirrus fails during execution of a certain playbook, the remaining playbooks will not be executed and pg_cirrus will gracefully exit.

Replication

In pg_cirrus, physical replication is set up using pg_basebackup. All data from primary node gets replicated to standby nodes. When primary node is set up, replication slots are created in primary node against standby nodes. After failover when a standby node is promoted as the new primary node, a replication slot is created in the newly promoted primary node and the remaining standby node continues to replicate from this new primary node.

Security

To make pg_cirrus secure, passwords are stored using ansible vaults. All nodes of the cluster are restricted to the same subnet whereas only pgpool node is accessible from outside the subnet using a password. Primary and standby nodes can only be accessed from within the cluster with a password.

Links

To help you get started with pg_cirrus, we have provided the following resources:

About Stormatics

Stormatics provides Professional Services for PostgreSQL. Our mission is to help businesses scale PostgreSQL reliably for their mission-critical data.