In the past few recipes, we have seen how a DCS can be set up using etcd and how a watchdog/softdog can be configured to avoid split-brain upon failover. More importantly, in the previous two recipes, we learned how a Patroni configuration file can be created and how a Patroni service can be enabled. In this recipe, we shall discuss how a PostgreSQL primary cluster can be initialized using Patroni.
Getting ready...
You must complete the previous four recipes before you attempt this recipe. The Patroni configuration file being referenced in this recipe is same as the configuration file shown in Step 9 of the How to do it... section of the Creating a Patroni configuration file recipe.
The following steps are being performed on the primary database only.
How to do it...
Let's initialize the database, as follows:
- Start the Patroni service using systemctl, as shown in the following command:
$ sudo systemctl start patroni
- See...