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
This commit is contained in:
Jason Tedor 2016-12-01 17:23:51 -05:00 committed by GitHub
parent 6522538033
commit 32df032c59
4 changed files with 16 additions and 4 deletions

View File

@ -52,11 +52,18 @@ case "$1" in
esac
# to pick up /usr/lib/sysctl.d/elasticsearch.conf
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
if command -v systemctl >/dev/null; then

View File

@ -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

View File

@ -112,6 +112,8 @@ sudo rpm --install elasticsearch-{version}.rpm
endif::[]
include::skip-set-kernel-parameters.asciidoc[]
include::init-systemd.asciidoc[]
[[rpm-running-init]]

View File

@ -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`.