From 32df032c5944326e351a7910a877d1992563f791 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Thu, 1 Dec 2016 17:23:51 -0500 Subject: [PATCH] Add option to skip kernel parameters on install During package install on systemd-based systems, we try to set vm.max_map_count. On some systems (e.g., containers), users do not have the ability to tune these parameters from within the container. This commit provides an option for these users to skip setting such kernel parameters. Relates #21899 --- distribution/src/main/packaging/scripts/postinst | 15 +++++++++++---- docs/reference/setup/install/deb.asciidoc | 1 + docs/reference/setup/install/rpm.asciidoc | 2 ++ .../install/skip-set-kernel-parameters.asciidoc | 2 ++ 4 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 docs/reference/setup/install/skip-set-kernel-parameters.asciidoc diff --git a/distribution/src/main/packaging/scripts/postinst b/distribution/src/main/packaging/scripts/postinst index 3d5eeeedd8f..d9f7e6ae126 100644 --- a/distribution/src/main/packaging/scripts/postinst +++ b/distribution/src/main/packaging/scripts/postinst @@ -52,10 +52,17 @@ case "$1" in esac # to pick up /usr/lib/sysctl.d/elasticsearch.conf -if command -v /usr/lib/systemd/systemd-sysctl > /dev/null; then - /usr/lib/systemd/systemd-sysctl -elif command -v /lib/systemd/systemd-sysctl > /dev/null; then - /lib/systemd/systemd-sysctl +if [ "${ES_SKIP_SET_KERNEL_PARAMETERS:-false}" == "false" ]; then + if command -v /usr/lib/systemd/systemd-sysctl > /dev/null; then + /usr/lib/systemd/systemd-sysctl + elif command -v /lib/systemd/systemd-sysctl > /dev/null; then + /lib/systemd/systemd-sysctl + fi +elif [ "$ES_SKIP_SET_KERNEL_PARAMETERS" == "true" ]; then + echo "skipping setting kernel parameters" +else + echo "unrecognized value [$ES_SKIP_SET_KERNEL_PARAMETERS] for ES_SKIP_SET_KERNEL_PARAMETERS; must [false] (default) or [true]" + exit 1 fi if [ "x$IS_UPGRADE" != "xtrue" ]; then diff --git a/docs/reference/setup/install/deb.asciidoc b/docs/reference/setup/install/deb.asciidoc index c1d0425b430..6ca635ce06e 100644 --- a/docs/reference/setup/install/deb.asciidoc +++ b/docs/reference/setup/install/deb.asciidoc @@ -96,6 +96,7 @@ Examine +/etc/apt/sources.list.d/elasticsearch-{major-version}.list+ for the dup endif::[] +include::skip-set-kernel-parameters.asciidoc[] [[install-deb]] ==== Download and install the Debian package manually diff --git a/docs/reference/setup/install/rpm.asciidoc b/docs/reference/setup/install/rpm.asciidoc index acf9d6f2418..b737fbff127 100644 --- a/docs/reference/setup/install/rpm.asciidoc +++ b/docs/reference/setup/install/rpm.asciidoc @@ -112,6 +112,8 @@ sudo rpm --install elasticsearch-{version}.rpm endif::[] +include::skip-set-kernel-parameters.asciidoc[] + include::init-systemd.asciidoc[] [[rpm-running-init]] diff --git a/docs/reference/setup/install/skip-set-kernel-parameters.asciidoc b/docs/reference/setup/install/skip-set-kernel-parameters.asciidoc new file mode 100644 index 00000000000..56406fce987 --- /dev/null +++ b/docs/reference/setup/install/skip-set-kernel-parameters.asciidoc @@ -0,0 +1,2 @@ +NOTE: On systemd-based distributions, the installation scripts will attempt to set kernel parameters (e.g., +`vm.max_map_count`); you can skip this by setting the environment variable `ES_SKIP_SET_KERNEL_PARAMETERS` to `true`.