# Interpolation of discovery.zen.ping.unicast.hosts

**URL:** <https://discuss.elastic.co/t/interpolation-of-discovery-zen-ping-unicast-hosts/17811>\
**Category:** Elasticsearch\
**Created:** [May 29, 2014, 4:20pm UTC](https://discuss.elastic.co/t/interpolation-of-discovery-zen-ping-unicast-hosts/17811 "2014-05-29T16:20:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhughes](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@mhughes](https://discuss.elastic.co/u/mhughes)\
**Post date:** [May 29, 2014, 4:20pm UTC](https://discuss.elastic.co/t/interpolation-of-discovery-zen-ping-unicast-hosts/17811/1 "2014-05-29T16:20:06Z")

</div>

I'm trying to set up unicast discovery. I want to pass in the hosts via  
environment variable and am relying on elasticsearch.yml support of  
environment variable interpolation.

Tried two formats without any luck:

First approach (pass in contents of array):

export ES\_HOSTS='"one", "two"'  
discovery.zen.ping.unicast.hosts: [${ES\_HOSTS}]

org.elasticsearch.common.settings.SettingsException: Failed to load  
settings from [file:/etc/elasticsearch/elasticsearch.yml]  
at  
org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromStream(ImmutableSettings.java:920)  
at  
org.elasticsearch.common.settings.ImmutableSettings$Builder.loadFromUrl(ImmutableSettings.java:904)  
at  
org.elasticsearch.node.internal.InternalSettingsPreparer.prepareSettings(InternalSettingsPreparer.java:77)  
at  
org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:106)  
at org.elasticsearch.bootstrap.Bootstrap.main(Bootstrap.java:177)  
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:32)  
Caused by: while parsing a flow sequence  
in 'reader', line 326, column 35:  
discovery.zen.ping.unicast.hosts: [${ES\_HOSTS}]  
^  
expected ',' or ']', but got FlowMappingStart  
in 'reader', line 326, column 37:  
discovery.zen.ping.unicast.hosts: [${ES\_HOSTS}]

Second Approach (pass in full quoted array):

export ES\_HOSTS='["one", "two"]'  
discovery.zen.ping.unicast.hosts: ${ES\_HOSTS}

1. ElasticsearchIllegalArgumentException[Failed to resolve address for  
[["es1"]]]  
NumberFormatException[For input string: ""es1""]2)  
IllegalStateException[This is a proxy used to support circular references  
involving constructors. The object we're proxying is not constructed yet.  
Please wait until after injection has completed to use this object.]

Any ideas? Is there a doc somewhere that describes how the interpolation  
occurs? The first error scares me a bit as it seems interpolation happens  
after some other parsing.

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/701b9022-b4e5-4422-b376-ab01fba3c233%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/701b9022-b4e5-4422-b376-ab01fba3c233%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![brian\_yoder](https://avatars.discourse-cdn.com/v4/letter/b/f1d935/32.png) [@brian\_yoder](https://discuss.elastic.co/u/brian_yoder)\
**Post date:** [May 29, 2014, 8:09pm UTC](https://discuss.elastic.co/t/interpolation-of-discovery-zen-ping-unicast-hosts/17811/2 "2014-05-29T20:09:01Z")

</div>

I believe that the host names must be comma-separated and no quotes or  
other punctuation should be present. The config within the environment  
variable or java -D (system properties) is YAML-like, not JSON. No blanks  
between the names, for example:

export ES\_HOSTS=host1,host2,host3

When configuring Unicast, here are the java -D options I use in my own  
custom Elasticsearch start-up / shutdown / status script:

-Des.discovery.zen.ping.multicast.enabled=false  
-Des.discovery.zen.ping.unicast.hosts=host1,host2,host3  
-Des.discovery.zen.minimum\_master\_nodes=2

Brian

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/d2dad32b-00c7-4c61-b08c-503f5b29c3c6%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/d2dad32b-00c7-4c61-b08c-503f5b29c3c6%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![mhughes](https://avatars.discourse-cdn.com/v4/letter/m/85e7bf/32.png) [@mhughes](https://discuss.elastic.co/u/mhughes)\
**Post date:** [May 30, 2014, 1:25pm UTC](https://discuss.elastic.co/t/interpolation-of-discovery-zen-ping-unicast-hosts/17811/3 "2014-05-30T13:25:05Z")

</div>

Yes that works. Docs could really use work there though. The same string  
in elasticsearch.yml is ["one", "two", "three"], so I assumed I'd need to  
pass in brackets.

On Thursday, May 29, 2014 4:09:02 PM UTC-4, InquiringMind wrote:

> I believe that the host names must be comma-separated and no quotes or  
> other punctuation should be present. The config within the environment  
> variable or java -D (system properties) is YAML-like, not JSON. No blanks  
> between the names, for example:
> 
> export ES\_HOSTS=host1,host2,host3
> 
> When configuring Unicast, here are the java -D options I use in my own  
> custom Elasticsearch start-up / shutdown / status script:
> 
> -Des.discovery.zen.ping.multicast.enabled=false  
> -Des.discovery.zen.ping.unicast.hosts=host1,host2,host3  
> -Des.discovery.zen.minimum\_master\_nodes=2
> 
> Brian

--  
You received this message because you are subscribed to the Google Groups "elasticsearch" group.  
To unsubscribe from this group and stop receiving emails from it, send an email to [elasticsearch+unsubscribe@googlegroups.com](mailto:elasticsearch+unsubscribe@googlegroups.com).  
To view this discussion on the web visit [https://groups.google.com/d/msgid/elasticsearch/9080aad2-f967-4702-a667-b4a30b703fa5%40googlegroups.com](https://groups.google.com/d/msgid/elasticsearch/9080aad2-f967-4702-a667-b4a30b703fa5%40googlegroups.com).  
For more options, visit [https://groups.google.com/d/optout](https://groups.google.com/d/optout).

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 1:25am UTC](https://discuss.elastic.co/t/interpolation-of-discovery-zen-ping-unicast-hosts/17811/4 "2017-07-06T01:25:48Z")

</div>


