Skip to content

Commit

Permalink
Set vm.max_map_count on systemd package install
Browse files Browse the repository at this point in the history
Our docs claim that we set vm.max_map_count automatically. This is not
quite the case. The story is that on SysV init we set vm.max_map_count
each time the service starts, which is good. On systemd, we create a
sysctl.d conf file that sets vm.map_max_count, but this is only
meaningful if the system is rebooted after package install. This commit
modifies the post-install script so that we run systemd-sysctl so that
the vm.max_map_count change occurs after package install without a
reboot.

Relates #21507
  • Loading branch information
jasontedor committed Nov 11, 2016
1 parent 03ffdba commit 080bb47
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions distribution/src/main/packaging/scripts/postinst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,11 @@ 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
fi

if [ "x$IS_UPGRADE" != "xtrue" ]; then
if command -v systemctl >/dev/null; then
echo "### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ verify_package_installation() {
assert_file "/usr/lib/systemd/system/elasticsearch.service" f root root 644
assert_file "/usr/lib/tmpfiles.d/elasticsearch.conf" f root root 644
assert_file "/usr/lib/sysctl.d/elasticsearch.conf" f root root 644
[[ $(sysctl vm.max_map_count) =~ "vm.max_map_count = 262144" ]]
fi

if is_sysvinit; then
Expand Down

0 comments on commit 080bb47

Please sign in to comment.