From 79930048db4e8a1e4bd6512922bd78e440e50e4c Mon Sep 17 00:00:00 2001 From: Takuya ASADA Date: Tue, 28 Jul 2020 02:20:58 +0900 Subject: [PATCH] scylla_post_install.sh: generate memory.conf for CentOS7 On CentOS7, systemd does not support percentage-based parameter. To apply memory parameter on CentOS7, we need to override the parameter in bytes, instead of percentage. Fixes #6783 (cherry picked from commit 3a25e7285ba6dadb2e6990dc21011777148e70fe) --- scylla_post_install.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/scylla_post_install.sh b/scylla_post_install.sh index 411295ce14..fddff31222 100755 --- a/scylla_post_install.sh +++ b/scylla_post_install.sh @@ -63,6 +63,17 @@ MemoryHigh=1200M MemoryMax=1400M MemoryLimit=1400M EOS + +# On CentOS7, systemd does not support percentage-based parameter. +# To apply memory parameter on CentOS7, we need to override the parameter +# in bytes, instead of percentage. +elif [ "$RHEL" -a "$VERSION_ID" = "7" ]; then + MEMORY_LIMIT=$((MEMTOTAL_BYTES / 100 * 5)) + mkdir -p /etc/systemd/system/scylla-helper.slice.d/ + cat << EOS > /etc/systemd/system/scylla-helper.slice.d/memory.conf +[Slice] +MemoryLimit=$MEMORY_LIMIT +EOS fi systemctl --system daemon-reload >/dev/null || true