Using walctl to create replica
In this recipe, we are going to use the walctl_clone
utility to create a clone/replica
How to do it...
For this recipe only two servers are needed. One is the primary server and the other is the replica server. Our primary server will be named pg-primary
and the replica will be named pg-clone
server.
We need to execute the following command on the replica server:
walctl_clone pg-primary walctl
How it works...
walctl_clone
has two parameters. The first parameter is supposed to be the hostname of the primary server and the second parameter should be the name of the database superuser with which we are going to create a backup.
Here are the series of actions that are performed on behalf of walctl_clone
:
It puts the primary server in the backup mode.
It retrieves all files from the database. It will copy only the changed files if all the data files are residing in the data directory.
Once it has copied the respective files it will end the backup mode on the primary server...