The recipes we've discussed so far should help with setting up a Patroni cluster with multiple servers. In this recipe, we shall discuss how a manual switchover can be performed using Patroni.
Getting ready...
To perform a failover, we must have a Patroni cluster running without any errors reported alongside the configuration. You must have completed all the recipes in this chapter to ensure a switchover can occur with Patroni.
How to do it...
Follow these steps to complete this recipe:
- Validate the status of the Patroni cluster using the list command:
$ patronictl -c /etc/patroni/patroni.yml list percona_hacluster
+ Cluster: percona_hacluster (6879907124853122699) --+
| Member | Host | Role | State | TL | Lag in MB |
+--------+------+---------+---------+----+-----------+
| pg1 | pg1 | Leader | running | 7 | |
| pg2 | pg2 | Replica | running | 7 | 0 |
+--------+------+---------+---------+----+-----------+
- Run the switchover command...