How to set node.roles for a coordinating only node via environment variable?

Same as in:

We, for instance, run ES via:

docker run ... -e node.roles=<What to define here for a coordinating only node?!?> ...

I tried various combinations like:

-e node.roles=
-e node.roles=''
-e node.roles=""

-e node.roles='""'
-e node.roles="''"
-e node.roles=[]
-e node.roles='[]'
-e node.roles="[]"
-e node.roles=[ ]
-e node.roles='[ ]'
-e node.roles="[ ]"
-e node.roles=()
-e node.roles='()'
-e node.roles="()"
-e node.roles=\'\'
... and more ...

... to no avail. (The first three work basically. They behave as if node.roles hasn't been mentioned at all and apply the default node settings.)

I even tried to find out how ES parses and interprets settings via environment at GitHub - elastic/elasticsearch: Free and Open, Distributed, RESTful Search Engine but I didn't find the regarding piece of code yet.

I had similar problem and in the end I created my own docker image with customized entrypoint that updates elasticsearch.yml using envsubst

envsubst "${envvars}" < '/etc/elasticsearch/elasticsearch.template' > '/etc/elasticsearch/elasticsearch.yml'

envvars contains list of environment variables that I want to be processed, by default, without specifying individual variables, all variables are replaced. Also note, that if corresponding environment variable is missing it will be replaced by empty string.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.