问题描述
我已经安装了 ElasticSearch 服务器,我正在运行它:
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
如何配置 Java 客户端以连接到此服务器?我刚刚:
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)
如果我将 java 客户端配置为:
If i'm configuring java client as:
node.data=false
我收到以下日志:
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.
服务器和客户端都在同一台机器上启动.192.168.1.106:9200 可以从浏览器访问.
Both server and client are started on same machine. 192.168.1.106:9200 are accessible from browser.
而且我找不到任何关于发现配置的好文档.我可以在哪里阅读有关 ElasticSearch 配置的更多信息?以及如何配置Java客户端?
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}
这意味着当前节点没有将其 IP 地址发布给其他节点,因此即使节点 IP 可能存在于 discovery.zen.ping.unicast.hosts<中,节点也不会识别此节点/strong>
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
解决方案在 elasticsearch.yml 中进行以下更改.添加
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.
这意味着现在您的节点是可发现的.使其在集群中可发现的第二步是将节点的 ip 地址添加到所有 master 节点的单播主机列表中,这样每当我们有一个新的 master 时,该节点就可以被新的 master 发现.
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.
这篇关于Elasticsearch 服务器发现配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!


大气响应式网络建站服务公司织梦模板
高端大气html5设计公司网站源码
织梦dede网页模板下载素材销售下载站平台(带会员中心带筛选)
财税代理公司注册代理记账网站织梦模板(带手机端)
成人高考自考在职研究生教育机构网站源码(带手机端)
高端HTML5响应式企业集团通用类网站织梦模板(自适应手机端)