To install PostgreSQL 11 manually, we must first add the repositories or download the necessary packages for the installation, install them and configure them correctly, depending on our infrastructure. All these steps take time, so let’s see how we could avoid this.
In this blog, we will see how to deploy this new PostgreSQL version with a few clicks using ClusterControl and how to manage it. As pre-requisite, please install the 1.7.1 version of ClusterControl on a dedicated host or VM.
Deploy PostgreSQL 11
To perform a new installation from ClusterControl, simply select the option “Deploy” and follow the instructions that appear. Note that if you already have a PostgreSQL 11 instance running, then you need to select the ‘Import Existing Server/Database’ instead.
When selecting PostgreSQL, we must specify User, Key or Password and port to connect by SSH to our PostgreSQL hosts. We also need the name for our new cluster and if we want ClusterControl to install the corresponding software and configurations for us.
Please check the ClusterControl user requirement for this task here.
After setting up the SSH access information, we must define the database user, version and datadir (optional). We can also specify which repository to use. In this case, we want to deploy PostgreSQL 11, so just select it and continue.
In the next step, we need to add our servers to the cluster we are going to create.
When adding our servers, we can enter IP or hostname.
In the last step, we can choose if our replication will be Synchronous or Asynchronous.
We can monitor the status of the creation of our new cluster from the ClusterControl activity monitor.
Once the task is finished, we can see our new PostgreSQL 11 cluster in the main ClusterControl screen.
Once we have our cluster created, we can perform several tasks on it, like adding a load balancer (HAProxy) or a new replica.
Scaling PostgreSQL 11
If we go to cluster actions and select “Add Replication Slave”, we can either create a new replica from scratch, or add an existing PostgreSQL database as a replica.
Let’s see how adding a new replication slave can be a really easy task.
As you can see in the image, we only need to choose our Master server, enter the IP address for our new slave server and the database port. Then, we can choose if we want ClusterControl to install the software for us, and if the replication slave should be Synchronous or Asynchronous.
In this way, we can add as many replicas as we want and spread read traffic between them using a load balancer, which we can also implement with ClusterControl.
We can see more information about the HA for PostgreSQL in a related blog.
From ClusterControl, you can also perform different management tasks like Reboot Host, Rebuild Replication Slave or Promote Slave, with one click.
In previous blogs we took a look on the backup and PITR ClusterControl features for PostgreSQL. Now, in the last ClusterControl version, we have the “verify/restore backup on a standalone host” and “create a cluster from an existing backup” features.
In ClusterControl, select your cluster and go to the “Backup” section to see your current backups.
In the “Restore” option, first, you can choose which backup will be restored.
There, we have three options.
The first one is the classic “Restore on node” option. This just restores the selected backup on a specific node.
The “Restore and verify on standalone host” option is a new ClusterControl PostgreSQL feature. This allows us to test the generated backup by restoring it on a standalone host. This is really useful to avoid any surprises in a disaster recovery scenario.
To use this feature, we need a dedicated host (or VM) that is not part of the cluster.
Add the dedicated host IP address and choose the desire options.
When the backup is verified, you can see the “Verified” icon in the backup list.
“Create Cluster From Backup” is another important new ClusterControl PostgreSQL feature.
As the name suggests it , this feature allow us to create a new PostgreSQL cluster with the data from the generated backup.
After choosing this option, we need to follow the same steps that we saw in the deploy section.
All the configuration like user, number of nodes or replication type can be different in this new cluster.
When the new cluster is created, you can see both, the old and the new one in the ClusterControl main screen.
As we have seen above, you can now deploy the latest PostgreSQL release, version 11 using ClusterControl. Once deployed, ClusterControl provides a whole range of features, from monitoring, alerting, automatic failover, backup, point-in-time recovery, backup verification, to scaling of read replicas. This can help you manage Postgres in a friendly and intuitive way. Give it a try!