Every high availability cluster must possess the capability to detect and route around server failures. Hardware faults, virtual instance crashes, mistyped commands, and any number of potential disasters lurk around every corner. The best way to determine the true resilience of our stack is to test it by breaking something.
Let's see what happens by attacking Patroni directly.
This recipe depends on the presence of the entire stack. Please complete all recipes until Installing and configuring HAProxy before continuing.
For this recipe, we should already have three PostgreSQL servers. As usual, we'll assume they are named
pg2 is the current primary, follow these steps to simulate a server failure:
- Execute the following command as the
pkill -f patroni
- Follow the Patroni log on
pg3with this command:
tail -f /var/log/postgresql/patroni.log