弹性搜索服务器发现配置 [英] Elasticsearch server discovery configuration

查看:117
本文介绍了弹性搜索服务器发现配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经安装了ElasticSearch服务器,我正在运行:

  $ ./elasticsearch -f 
{0.18.2} [11698]:初始化...
loaded [],sites []
{0.18.2} [11698]:已初始化
{0.18.2} [11698 ]:开始...
bound_address {inet [/ 0:0:0:0:0:0:0:0:0:9300]},publish_address {inet [/192.168.1.106:9300]}
new_master [Stingray] [ocw4qPdmSfWuD9pUxHoN1Q] [inet [/192.168.1.106:9300]],原因:zen-disco-join(elect_as_master)
elasticsearch / ocw4qPdmSfWuD9pUxHoN1Q
恢复[0]索引到cluster_state
bound_address {inet [/ 0:0:0:0:0:0:0:0:9200]},publish_address {inet [/192.168.1.106:9200]}
{0.18.2} [11698 ]:启动

我如何配置Java客户端连接到此服务器?
我只是:

  node.client = true 

但是,尝试连接后,我收到:

  org.elasticsearch.discovery.MasterNotDiscoveredException:
在org.elasticsearch.action.support.master.TransportMasterNodeOperationAction $ 3.onTimeout(TransportMasterNodeOperationAction.java:162)

如果我正在配置java客户端:

  node.data = false 

我正在获取以下日志:



主要节点:内部信息:93 - [Stark,Tony] {0.18.2} [13008]:启动...
INFO主要传输:internalInfo:93 - [Stark,Tony] bound_address {inet [/ 0:0:0:0:0:0:0:0:9301]},publish_address {inet [/192.168.1.106:9301]}
INFO elasticsearch [Stark ,Tony] clusterService#updateTask-pool-13-thread-1 service:internalInfo:93 - [Stark,Tony] new_master [Stark,Tony] [WkNn96hgTkWXRnsR0EOZjA] [inet [/192.168.1.106:9301]] {data = false},原因:禅宗 - 加入(elect_as_master)

据我所知,这意味着这个新的节点(应该是客户端节点)使自己成为一个新的主节点。我不是从日志中找到它并且连接到任何其他节点。



服务器和客户端都在同一台机器上启动。 192.168.1.106:9200可以从浏览器访问。



我找不到有关发现配置的任何好的文档。在哪里可以阅读有关ElasticSearch配置的更多信息?还有如何配置Java客户端?

解决方案

面临同样的问题,节点无法在节点上重新启动主节点。



问题在于节点之间的沟通。



请确保在弹性搜索日志中,是否节点重新启动说

  publish_address {127.0.0.1:9200} 

publish_address {0.0.0.1 :9200}

这意味着当前节点没有将其IP地址发布到其他节点,因此节点即使节点IP可能存在于 discovery.zen.ping.unicast.hosts




在elasticsearch.yml中进行以下更改。添加

  network.host:_non_loopback:ipv4_ 
并重新启动节点。
确保绑定的地址现在显示< IP地址>:< port no>而不是本地主机。

这意味着现在你的节点是可以发现的。使集群中可发现的第二个步骤是在所有主节点的单播主机列表中添加节点的IP地址,以便每当我们有一个新的主节点时,该节点就可以被新的主节点发现。 p>

 将节点IP添加到discovery.zen.ping.unicast.hosts 
所有主节点的主机列表中它不可接受A对单播列表中存在的所有
节点进行主控。


I've installed ElasticSearch server, that i'm running by:

$ ./elasticsearch -f
 {0.18.2}[11698]: initializing ...
 loaded [], sites []
 {0.18.2}[11698]: initialized
 {0.18.2}[11698]: starting ...
 bound_address {inet[/0:0:0:0:0:0:0:0:9300]}, publish_address {inet[/192.168.1.106:9300]}
 new_master [Stingray][ocw4qPdmSfWuD9pUxHoN1Q][inet[/192.168.1.106:9300]], reason: zen-disco-join (elected_as_master)
 elasticsearch/ocw4qPdmSfWuD9pUxHoN1Q
 recovered [0] indices into cluster_state
 bound_address {inet[/0:0:0:0:0:0:0:0:9200]}, publish_address {inet[/192.168.1.106:9200]}
 {0.18.2}[11698]: started

How I can configure Java client to connect to this server? I have just:

node.client=true

but, after trying to connect i'm receiving:

org.elasticsearch.discovery.MasterNotDiscoveredException: 
    at org.elasticsearch.action.support.master.TransportMasterNodeOperationAction$3.onTimeout(TransportMasterNodeOperationAction.java:162)

If i'm configuring java client as:

node.data=false

I'm getting following logs:

INFO main node:internalInfo:93 - [Stark, Tony] {0.18.2}[13008]: starting ...
INFO main transport:internalInfo:93 - [Stark, Tony] bound_address {inet[/0:0:0:0:0:0:0:0:9301]}, publish_address {inet[/192.168.1.106:9301]}
INFO elasticsearch[Stark, Tony]clusterService#updateTask-pool-13-thread-1 service:internalInfo:93 - [Stark, Tony] new_master [Stark, Tony][WkNn96hgTkWXRnsR0EOZjA][inet[/192.168.1.106:9301]]{data=false}, reason: zen-disco-join (elected_as_master)

As I understood it means that this new node (supposed to be client node) made itself a new master node. And I don't from log that it's found and connect to any other node.

Both server and client are started on same machine. 192.168.1.106:9200 are accessible from browser.

And I can't find any good documentation about discovery config. Where I can read more about ElasticSearch configurations? And how to configure Java client?

解决方案

Faced the same issue where the nodes were not able to elect a master on nodes restart.

The problem lies in the communication of nodes among themselves.

Please ensure in your elastic search logs, whether the node restart says

  publish_address {127.0.0.1:9200}
  or
  publish_address {0.0.0.1:9200}

This means the current node is not publishing its IP address to other nodes and hence the nodes won't recognise this node even though the node IP might be present in the discovery.zen.ping.unicast.hosts

Solution Make the following changes in elasticsearch.yml. Add

 network.host: _non_loopback:ipv4_
 and restart the node.
 Ensure that the bound address now shows the <IP address>:<port no> and not the localhost.

This means that now your node is discoverable. The second step to make it discoverable in the cluster is to add the ip address of the node in the unicast hosts lists of all the master nodes, so that whenever we have a new master, the node is discoverable to the new master.

   Add the node IP to the discovery.zen.ping.unicast.hosts 
   list of hosts of all the masters to make it disoverable. A masterpings all the 
   nodes present in the unicast list.

这篇关于弹性搜索服务器发现配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆