Skip to content

Commit e43283e

Browse files
committed
Override ES cgroup setting in elasticsearch-env
Although most environment variable handling related to Docker has already been moved from the entrypoint script to `elasticsearch-env`, there still remaining the setting of `ES_JAVA_OPTS` to override the cgroup hierarchy setting. Move this to the env script as well, so that Docker env var handling is done in one place.
1 parent 569841a commit e43283e

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

distribution/docker/src/docker/bin/docker-entrypoint.sh

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,20 +48,6 @@ fi
4848
# is idempotent.
4949
source /usr/share/elasticsearch/bin/elasticsearch-env-from-file
5050

51-
# The virtual file /proc/self/cgroup should list the current cgroup
52-
# membership. For each hierarchy, you can follow the cgroup path from
53-
# this file to the cgroup filesystem (usually /sys/fs/cgroup/) and
54-
# introspect the statistics for the cgroup for the given
55-
# hierarchy. Alas, Docker breaks this by mounting the container
56-
# statistics at the root while leaving the cgroup paths as the actual
57-
# paths. Therefore, Elasticsearch provides a mechanism to override
58-
# reading the cgroup path from /proc/self/cgroup and instead uses the
59-
# cgroup path defined the JVM system property
60-
# es.cgroups.hierarchy.override. Therefore, we set this value here so
61-
# that cgroup statistics are available for the container this process
62-
# will run in.
63-
export ES_JAVA_OPTS="-Des.cgroups.hierarchy.override=/ $ES_JAVA_OPTS"
64-
6551
if [[ -f bin/elasticsearch-users ]]; then
6652
# Check for the ELASTIC_PASSWORD environment variable to set the
6753
# bootstrap password for Security.

distribution/src/bin/elasticsearch-env

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,20 @@ if [[ "$ES_DISTRIBUTION_TYPE" == "docker" ]]; then
117117

118118
# Reset the positional parameters to the es_arg_array values and any existing positional params
119119
set -- "$@" "${es_arg_array[@]}"
120+
121+
# The virtual file /proc/self/cgroup should list the current cgroup
122+
# membership. For each hierarchy, you can follow the cgroup path from
123+
# this file to the cgroup filesystem (usually /sys/fs/cgroup/) and
124+
# introspect the statistics for the cgroup for the given
125+
# hierarchy. Alas, Docker breaks this by mounting the container
126+
# statistics at the root while leaving the cgroup paths as the actual
127+
# paths. Therefore, Elasticsearch provides a mechanism to override
128+
# reading the cgroup path from /proc/self/cgroup and instead uses the
129+
# cgroup path defined the JVM system property
130+
# es.cgroups.hierarchy.override. Therefore, we set this value here so
131+
# that cgroup statistics are available for the container this process
132+
# will run in.
133+
export ES_JAVA_OPTS="-Des.cgroups.hierarchy.override=/ $ES_JAVA_OPTS"
120134
fi
121135

122136
cd "$ES_HOME"

0 commit comments

Comments
 (0)