Go无法连接docker中es

2019-05-07  本文已影响0人  xyz098

报错

使用的第三方库"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'
上一篇 下一篇

猜你喜欢

热点阅读