From a8b73ef0215c77b994a1b65c45fa8a3f6236fc7b Mon Sep 17 00:00:00 2001 From: Nikolay Samokhvalov Date: Mon, 1 Aug 2022 14:55:45 +0200 Subject: [PATCH] systemd service options: restart patroni service if it crashed (#2372) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It makes little sense to have ` for the Patroni service – if it goes down and we don't notice it (I doubt that patroni service uptime is well monitored in most cases), then we lose autofailover for Postgres, implying bigger risks of downtime. `Restart=on-failure` makes more sense in this case. --- extras/startup-scripts/patroni.service | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/extras/startup-scripts/patroni.service b/extras/startup-scripts/patroni.service index b2289f75..7c156492 100644 --- a/extras/startup-scripts/patroni.service +++ b/extras/startup-scripts/patroni.service @@ -14,7 +14,7 @@ Group=postgres # Read in configuration file if it exists, otherwise proceed EnvironmentFile=-/etc/patroni_env.conf -# the default is the user's home directory, and if you want to change it, you must provide an absolute path. +# The default is the user's home directory, and if you want to change it, you must provide an absolute path. # WorkingDirectory=/home/sameuser # Where to send early-startup messages from the server @@ -32,14 +32,14 @@ ExecStart=/bin/patroni /etc/patroni.yml # Send HUP to reload from patroni.yml ExecReload=/bin/kill -s HUP $MAINPID -# only kill the patroni process, not it's children, so it will gracefully stop postgres +# Only kill the patroni process, not it's children, so it will gracefully stop postgres KillMode=process # Give a reasonable amount of time for the server to start up/shut down TimeoutSec=30 -# Do not restart the service if it crashes, we want to manually inspect database on failure -Restart=no +# Restart the service if it crashed +Restart=on-failure [Install] WantedBy=multi-user.target