How to specify unicast.hosts from environment variable?

Hi,

I would like to specify the master list via an environment variable, like this:
network.bind_host: ["${ES_HOST}","127.0.0.1"]
(this works)

What I try is the following:
export ES_MASTER_PORT=$((9300+$ES_MASTER_OFFSET))
export ES_MASTERS="["10.6.145.219:${ES_MASTER_PORT}","10.6.145.220:${ES_MASTER_PORT}","10.6.145.221:${ES_MASTER_PORT}"]"

And this in elasticsearch.yml:
discovery.zen.ping.unicast.hosts: "${ES_MASTERS}"

What I get is this:
Exception in thread "main" java.lang.IllegalArgumentException: Failed to resolve address for [["10.6.145.219:9300"]
Likely root cause: java.lang.IllegalArgumentException: Invalid bracketed host/port range: ["10.6.145.219:9300"
at org.elasticsearch.transport.netty.NettyTransport.parse(NettyTransport.java:718)
at org.elasticsearch.transport.netty.NettyTransport.addressesFromString(NettyTransport.java:696)
at org.elasticsearch.transport.TransportService.addressesFromString(TransportService.java:424)
at org.elasticsearch.discovery.zen.ping.unicast.UnicastZenPing.(UnicastZenPing.java:160)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at <<>>
at org.elasticsearch.node.Node.(Node.java:213)
at org.elasticsearch.node.Node.(Node.java:140)
at org.elasticsearch.node.NodeBuilder.build(NodeBuilder.java:143)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:194)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:286)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

Is it possible to achieve this somehow?

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