From a22a161182027f1d53ce5cd1b26ae9e3b31b387c Mon Sep 17 00:00:00 2001 From: emorino Date: Mon, 9 Mar 2020 17:35:17 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20unit=C3=A9=20systemd=20pour=20rendre=20?= =?UTF-8?q?PG=20moins=20killable?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HowtoPostgreSQL.md | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/HowtoPostgreSQL.md b/HowtoPostgreSQL.md index e6628060..e9abe25a 100644 --- a/HowtoPostgreSQL.md +++ b/HowtoPostgreSQL.md @@ -1254,3 +1254,28 @@ Voir [/HowtoPostgreSQL/Utilisation](). Vous utilisez une version non compatible avec votre base, essayez avec une version du paquet `ptop`. +### Rendre PostgreSQL moins susceptible d'ĂȘtre killer par l'OMkiller + +Voici une unitĂ© systemd avec des ajustements sur les variables d'environnement pour rendre PostgreSQL moins killable par l'OMkiller + +~~~ +# systemd service for managing all PostgreSQL clusters on the system. This +# service is actually a systemd target, but we are using a service since +# targets cannot be reloaded. + +[Unit] +Description=PostgreSQL RDBMS + +[Service] +OOMScoreAdjust=-1000 +Environment=PG_OOM_ADJUST_FILE=/proc/self/oom_score_adj +Environment=PG_MASTER_OOM_SCORE_ADJ=-1000 +Environment=PG_CHILD_OOM_SCORE_ADJ=0 +Type=oneshot +ExecStart=/bin/true +ExecReload=/bin/true +RemainAfterExit=on + +[Install] +WantedBy=multi-user.target +~~~