A server crash or a restart requires that we start Patroni manually. This may cause additional downtime for the application. For this purpose, a systemd service that auto-starts Patroni upon a crash or restart is needed. In this recipe, we shall look at the Patroni service file that can be enabled to manage Patroni using services.
Getting ready...
The systemd service we will be discussing in this recipe works for almost all the latest Linux operating systems where systemd works. Creating or managing services requires root access.
How to do it...
We will start Patroni using systemd. Let's get started:
- Create a patroni.service file in the usual systemd service files location with the following text:
# vi /usr/lib/systemd/system/patroni.service
- Append the following text to the preceding file:
# This is an example systemd config file for Patroni
# You can copy it to "/usr/lib/systemd/system/patroni.service"
[Unit]
Description=Runners...