Skip to content

Commit 1fde263

Browse files
authored
Set vm.max_map_count on systemd package install
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
1 parent 5f1d108 commit 1fde263

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

distribution/src/main/packaging/scripts/postinst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ case "$1" in
5151
;;
5252
esac
5353

54+
# to pick up /usr/lib/sysctl.d/elasticsearch.conf
55+
if command -v /usr/lib/systemd/systemd-sysctl > /dev/null; then
56+
/usr/lib/systemd/systemd-sysctl
57+
fi
58+
5459
if [ "x$IS_UPGRADE" != "xtrue" ]; then
5560
if command -v systemctl >/dev/null; then
5661
echo "### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd"

qa/vagrant/src/test/resources/packaging/scripts/os_package.bash

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ verify_package_installation() {
123123
assert_file "/usr/lib/systemd/system/elasticsearch.service" f root root 644
124124
assert_file "/usr/lib/tmpfiles.d/elasticsearch.conf" f root root 644
125125
assert_file "/usr/lib/sysctl.d/elasticsearch.conf" f root root 644
126+
[[ $(sysctl vm.max_map_count) =~ "vm.max_map_count = 262144" ]]
126127
fi
127128

128129
if is_sysvinit; then

0 commit comments

Comments
 (0)