Java客户端找不到主节点:MasterNotDiscoveredException等待[1m] [英] Java client can't find master node: MasterNotDiscoveredException waited for [1m]
问题描述
我使用vagrant,我使用debian软件包安装ES:
I'm using vagrant and I installed ES on it using the debian package:
elasticsearch-1.1.1.deb
在我的网络应用程序中,我正在使用jar:
In my web app, I am using the jar:
org.elasticsearch elasticsearch 1.1.1
我正在创建我的客户端:
I am creating my client like:
val node = nodeBuilder.client(true).node
val client: Client = node.client
当我尝试和索引时,我收到错误:
When I try and index I get the error:
val response = client.prepareIndex("articles", "article", article.id.toString).setSource(json).execute.actionGet
我遇到的错误是:
[MasterNotDiscoveredException: waited for [1m]]
我可以看到我的ES实例正常工作:
I can see my ES instance is working fine by going to:
http://localhost:9200
我从README f运行了一些测试查询ile,他们工作正常,但现在由于某种原因它不工作:
I ran some test queries from the README file and they worked fine, but now for some reason it isn't working either:
http://localhost:9200/twitter/user/kimchy?pretty=true
我收到错误:
{
"error" : "ClusterBlockException[blocked by: [SERVICE_UNAVAILABLE/1/state not recovered / initialized];[SERVICE_UNAVAILABLE/2/no master];]",
"status" : 503
}
vagrant file 2 ports open for elastic search:
My vagrant file 2 ports open for elastic search:
config.vm.network "forwarded_port", guest: 9200, host: 9200 # ES
config.vm.network "forwarded_port", guest: 9300, host: 9300 # ES
什么似乎是问题?
注意:我的网络应用程序没有使用elasticsearch.yml文件,因为它只是从我所理解的连接到默认的localhost:9200。
Note: my web application isn't using a elasticsearch.yml file because it is just connecting to the default localhost:9200 from what I understand.
推荐答案
uncomment discovery.zen.ping.multicast.enabled:false
in /etc/elasticsearch/elasticsearch.yml
uncomment discovery.zen.ping.multicast.enabled: false
in /etc/elasticsearch/elasticsearch.yml
这篇关于Java客户端找不到主节点:MasterNotDiscoveredException等待[1m]的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!