Skip to content
This repository has been archived by the owner on Nov 7, 2018. It is now read-only.

Add source of shard awareness attr #61

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ ENV NUMBER_OF_MASTERS 1
ENV MAX_LOCAL_STORAGE_NODES 1
ENV SHARD_ALLOCATION_AWARENESS ""
ENV SHARD_ALLOCATION_AWARENESS_ATTR ""
ENV SHARD_ALLOCATION_AWARENESS_ATTR_SOURCE FILE
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why default to file and break existing behavior?

ENV MEMORY_LOCK true
ENV REPO_LOCATIONS []

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ This image can be configured by means of environment variables, that one can set
* [ES_PLUGINS_INSTALL](https://www.elastic.co/guide/en/elasticsearch/plugins/current/installation.html) - comma separated list of Elasticsearch plugins to be installed. Example: `ES_PLUGINS_INSTALL="repository-gcs,x-pack"`
* [SHARD_ALLOCATION_AWARENESS](https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-awareness.html#CO287-1)
* [SHARD_ALLOCATION_AWARENESS_ATTR](https://www.elastic.co/guide/en/elasticsearch/reference/current/allocation-awareness.html#CO287-1)
* SHARD_ALLOCATION_AWARENESS_ATTR_SOURCE - use file or environment variable for attribute contents
* [MEMORY_LOCK](https://www.elastic.co/guide/en/elasticsearch/reference/current/important-settings.html#bootstrap.memory_lock) - memory locking control - enable to prevent swap (default = `true`) .
* [REPO_LOCATIONS](https://www.elastic.co/guide/en/elasticsearch/reference/current/modules-snapshots.html#_shared_file_system_repository) - list of registered repository locations. For example `["/backup"]` (default = `[]`).
* [PROCESSORS](https://github.com/elastic/elasticsearch-definitive-guide/pull/679/files) - allow elasticsearch to optimize for the actual number of available cpus (must be an integer - default = 1)
Expand Down
7 changes: 6 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,12 @@ if [ ! -z "${SHARD_ALLOCATION_AWARENESS_ATTR}" ]; then
# this will map to a file like /etc/hostname => /dockerhostname so reading that file will get the
# container hostname
if [ "$NODE_DATA" == "true" ]; then
ES_SHARD_ATTR=`cat ${SHARD_ALLOCATION_AWARENESS_ATTR}`
# whether or not to use the environment variable for the attr vs volume
SHARD_ALLOCATION_AWARENESS_ATTR_SOURCE="$(echo "${SHARD_ALLOCATION_AWARENESS_ATTR_SOURCE}" | tr '[a-z]' '[A-Z]')"
case "${SHARD_ALLOCATION_AWARENESS_ATTR_SOURCE}" in
ENV) ES_SHARD_ATTR="${SHARD_ALLOCATION_AWARENESS_ATTR}" ;;
*) ES_SHARD_ATTR=`cat ${SHARD_ALLOCATION_AWARENESS_ATTR}` ;;
esac
NODE_NAME="${ES_SHARD_ATTR}-${NODE_NAME}"
echo "node.attr.${SHARD_ALLOCATION_AWARENESS}: ${ES_SHARD_ATTR}" >> $BASE/config/elasticsearch.yml
fi
Expand Down