Interpolation of discovery.zen.ping.unicast.hosts


(Matt Hughes) #1

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/701b9022-b4e5-4422-b376-ab01fba3c233%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Brian Yoder) #2

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/d2dad32b-00c7-4c61-b08c-503f5b29c3c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(Matt Hughes) #3

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/elasticsearch/9080aad2-f967-4702-a667-b4a30b703fa5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


(system) #4