Elasticsearch Tribe节点配置

时间:2016-05-03 08:34:27

标签: elasticsearch

我是Elasticsearch的新手,正在尝试在Elasticsearch中设置一个部落节点。 对不起,如果问题不是很聪明,但我需要帮助。

我正在使用在RHEL Server 6.6和Java 1.7.8上运行的Elasticserach 2.3.1。 我有2个集群,每个集群中有1个主节点和1个数据节点。

当我尝试在集群1中设置并启动部落节点时,出现错误:

我的Tribe节点设置为:

 tribe:
 sample-cluster1:
 cluster.name: sample-cluster1
 discovery.zen.ping.unicast.hosts: ["host1", "host2"]
 discovery.zen.ping.multicast.enabled: false 
 sample-cluster2: 
 cluster.name: sample-cluster2
 discovery.zen.ping.unicast.hosts: ["host3", "host4"]
 discovery.zen.ping.multicast.enabled: false 

我收到以下错误:

Exception in thread "main" SettingsException[Failed to load settings from [elasticsearch.yml]]; nested: ElasticsearchParseException[duplicate settings key [cluster.name] found at line number [34], column number [16], previous value [sample-cluster1], current value [sample-cluster2]];
Likely root cause: ElasticsearchParseException[duplicate settings key [cluster.name] found at line number [34], column number [16], previous value [sample-cluster1], current value [sample-cluster2]]
        at org.elasticsearch.common.settings.loader.XContentSettingsLoader.serializeValue(XContentSettingsLoader.java:151)
        at org.elasticsearch.common.settings.loader.XContentSettingsLoader.serializeObject(XContentSettingsLoader.java:109)
        at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:67)
        at org.elasticsearch.common.settings.loader.XContentSettingsLoader.load(XContentSettingsLoader.java:45)
        at org.elasticsearch.common.settings.loader.YamlSettingsLoader.load(YamlSettingsLoader.java:46)
        at org.elasticsearch.common.settings.Settings$Builder.loadFromStream(Settings.java:1071)
        at org.elasticsearch.common.settings.Settings$Builder.loadFromPath(Settings.java:1058)
        at org.elasticsearch.node.internal.InternalSettingsPreparer.prepareEnvironment(InternalSettingsPreparer.java:88)
        at org.elasticsearch.bootstrap.Bootstrap.initialSettings(Bootstrap.java:202)
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:241)
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)

但是,如果我在第二个群集设置中更改配置,则没有错误并且服务器启动:

我的修改设置:

sample-cluster1:
 cluster.name: sample-cluster1
 discovery.zen.ping.unicast.hosts: ["host1", "host2"]
 discovery.zen.ping.multicast.enabled: false 
 sample-cluster2: 
 cluster.name1: sample-cluster2
 discovery.zen.ping.unicast.hosts1: ["host3", "host4"]
 discovery.zen.ping.multicast.enabled1: false 

我不确定在第一次配置中我缺少什么,以及第二次配置是否正确。我假设我无法更改elasticsearch键:

cluster.name to cluster.name1
discovery.zen.ping.unicast.hosts to discovery.zen.ping.unicast.hosts1
discovery.zen.ping.multicast.enabled to discovery.zen.ping.multicast.enabled1

1 个答案:

答案 0 :(得分:0)

找到修复程序,它现在可以正常工作了。这是一个愚蠢的错误。 解决方案是我必须为第二个集群配置中的所有参数添加额外的空格。

sample-cluster1:
 cluster.name: sample-cluster1
 discovery.zen.ping.unicast.hosts: ["host1", "host2"]
 discovery.zen.ping.multicast.enabled: false 
sample-cluster2: 
  cluster.name: sample-cluster2
  discovery.zen.ping.unicast.hosts: ["host3", "host4"]
  discovery.zen.ping.multicast.enabled: false