Help me set elasticsearch.yml variable

This is the contents of my elasticsearch.yml file.


cluster.name: test-cluster
node.name: test-m
node.master: true
node.data: false

cluster.initial_master_nodes: ["${ES_MASTER_NODES}"]
discovery.seed_hosts: ["${ES_SEED_HOSTS}"]

network.host: 0.0.0.0
network.publish_host: ${ES_PUBLISH_HOST}

'discovery.seed_hosts' don't recognize it properly

'discovery.seed_hosts : ['192.xxx.xxx.11 ','192.xxx.xxx.12 ','192.xxx.xxx.13 ']
Works fine.
However, I want to create a variable called '$ {ES_SEED_HOSTS}' and use it to run it.

${ES_SEED_HOSTS} = "'192.xxx.xxx.11','192.xxx.xxx.12','192.xxx.xxx.13'"

[2020-03-19T08:04:10,831][WARN ][o.e.d.SeedHostsResolver ] [test-m] failed to resolve host ['192.xxx.xxx.11']Preformatted text
java.net.UnknownHostException: '192.xxx.xxx.11'
[2020-03-19T08:04:10,831][WARN ][o.e.d.SeedHostsResolver ] [test-m] failed to resolve host ['192.xxx.xxx.12']
java.net.UnknownHostException: '192.xxx.xxx.12'
[2020-03-19T08:04:10,831][WARN ][o.e.d.SeedHostsResolver ] [test-m] failed to resolve host ['192.xxx.xxx.13']
java.net.UnknownHostException: '192.xxx.xxx.13'

How should we put the value of the variable?
{ES_SEED_HOSTS} / ~ export ES_SEED_HOSTS=" ?? "

I'm using an older (6.8) version of Elasticsearch so I call my environment variable ES_DISOVERY_HOSTS which I export with a setting like this:

export ES_DISCOVERY_HOSTS="master1:9260","master2:9260","master3:9260"

where I include the port numbers because I run several master eligible instances on the same physical servers (listening to different ports for different clusters).

Then all I need to do in elasticsearch.yml on each data node is add

discovery.zen.ping.unicast.hosts: ${ES_DISCOVERY_HOSTS}

In your case this would be discovery.seed_hosts.

Good luck!

The version I installed is 7.4.2
If you enter it directly without using an environment variable, the execution will work fine.
What I want is to put an environment variable in discovery.seed_hosts but is that impossible?

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