Welcome to the first installment of our series: Scalable Solutions with Percona Distribution for PostgreSQL. In this guide, we will demonstrate how to establish a Citus database spanning multiple nodes by using Percona Distribution for PostgreSQL. This setup empowers your database to efficiently manage increased data volumes, enhance performance, and maintain availability.

This initial section will guide you through establishing a Percona Distribution PostgreSQL in three EC2 instances.

Then, in the next part of this series, Scalable Solutions with Percona Distribution for PostgreSQL (Part 2): Using Citus, we will use these worker nodes to establish a multi-node Citus cluster and implement sharding techniques.

This tutorial will use Ubuntu 20.04 and Percona Distribution for PostgreSQL 15.

What we have so far is this:

  • Three EC2 instances in the same subnet.

Three EC2 instances in the same subnet

  • A security group in AWS for PostgreSQL with inbound rules allowing traffic on ports 5432, 5433, and 5434 for PostgreSQL.

Installing Percona Distribution for PostgreSQL on the three instances

Let’s first install Percona Distribution for PostgreSQL on each EC2 instance. Use the following procedure for all the three nodes.

Now, let’s verify if the service is operating correctly.

You should see this output, indicating an ‘Active’ status in all the instances.

If you want to check the version of Percona PostgreSQL, you can use the ‘psql’ command-line utility for interacting with PostgreSQL databases. To do this, open a terminal and run the following SQL query: “SELECT version();” This will display the version of Percona Distribution PostgreSQL installed on your system.

You will have this as an output:

Configuring postgresql.conf on three instances

Before starting the database on each node, modifying specific configuration files is essential. To do this, follow these steps:

  1. Navigate to the PostgreSQL Configuration Directory: Locate the ‘postgresql.conf’ file, typically found at the path ‘/etc/postgresql/15/main’. You will need to access this file to make the necessary adjustments.
  2. Log in as the ‘postgres’ User: To access and modify the ‘postgresql.conf’ file, you should log in using the “postgres” user account, ensuring the necessary permissions for configuration changes.

      3. Configure Essential Settings: You’ll configure vital settings within the ‘postgresql.conf’ file. These settings may include specifying each node’s IP address, PORT, and SSL certificate. Ensure that these values align with your desired database configuration.

Node main

Node worker01

Node worker02

Configuring pg_hba.conf for three instances

Now, let’s modify ‘pg_hba.conf,’ which can be found in the same directory as the ‘postgresql.conf’ file: ‘/etc/postgresql/15/main’.

Node main

Node worker01

Node worker02

Note: Using “trust” in the settings is too permissive. See Citus notes about Increasing Worker Security. The PostgreSQL manual explains how to make them more restrictive.

Restart all PostgreSQL instances

Now, we will start the PostgreSQL instances. 

Three nodes of Percona PostgreSQL that are listening on ports 5432, 5433, and 5434.

Node main on port 5432

Worker01 on port 5433

Worker02 on port 5434

Are you ready to see what we can do with these Percona Distributions for PostgreSQL nodes? 

Check the Scalable Solutions with Percona Distribution for PostgreSQL (Part 2): Using Citus, and Percona Distribution for PostgreSQL 15: An Introduction to Scalable Database Solutions.

In the meantime, you can learn more about the Percona Distribution for PostgreSQL. Additionally, if you’re interested in deploying PostgreSQL on Kubernetes, you can explore information about the Percona Operator for PostgreSQL.

You can also contact Percona’s experts for assistance in maximizing your application’s performance. We offer support for open-source databases, managed services, and consulting services, or visit our Percona Community forum; we are happy to help.

Percona Distribution for PostgreSQL provides the best and most critical enterprise components from the open-source community, in a single distribution, designed and tested to work together.

 

Download Percona Distribution for PostgreSQL Today!

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments