美文网首页
Go无法连接docker中es

Go无法连接docker中es

作者: xyz098 | 来源:发表于2019-05-07 12:20 被阅读0次

报错

使用的第三方库"gopkg.in/olivere/elastic.v5"

no active connection found: no Elasticsearch node available

解决

Docker No Elastic Node Aviable

关闭sniff模式;或者设置es的地址为publish_address 地址

代码设置sniff 为false

client, err := elastic.NewClient(elastic.SetSniff(false), elastic.SetURL(url))

分析

It has to do something with the way sniffing works (see details in the Wiki). The node IPs are probably not accessible from your application.When you enable sniffing, it will retrieve the node IPs from the http.publish_address. And that seems to be routeable

查看publish_address

curl -XGET '0.0.0.0:9200/_nodes/http?pretty'

相关文章

网友评论

      本文标题:Go无法连接docker中es

      本文链接:https://www.haomeiwen.com/subject/whreoqtx.html