Go 找不到活动连接

Go 找不到活动连接,go,logging,beego,Go,Logging,Beego,我在用elasticsearch,docker上的kibana,然后开始 time=“2019-09-17T09:52:02+08:00”level=panic msg=“未找到活动连接:没有可用的Elasticsearch节点” 恐慌:(*logrus.Entry)(0x736fe0,0xc000136150) 这是我正在使用的软件包 您必须进行身份验证,如果您没有更改默认密码,您可能会使用以下内容: 还引起了嗅嗅。详情如下: import ( "github.com/olivere/ela

我在用elasticsearch,docker上的kibana,然后开始

time=“2019-09-17T09:52:02+08:00”level=panic msg=“未找到活动连接:没有可用的Elasticsearch节点” 恐慌:(*logrus.Entry)(0x736fe0,0xc000136150)

这是我正在使用的软件包


您必须进行身份验证,如果您没有更改默认密码,您可能会使用以下内容: 还引起了嗅嗅。详情如下:

import (
"github.com/olivere/elastic/v7"
"github.com/sirupsen/logrus"
"gopkg.in/sohlich/elogrus.v7"
)

func main() {
 log := logrus.New()
 client, err := elastic.NewClient(elastic.SetURL("http://localhost:9200"))
if err != nil {
    log.Panic(err)
}
 hook, err := elogrus.NewAsyncElasticHook(client, "localhost", logrus.DebugLevel, "mylog")
 if err != nil {
    log.Panic(err)
}
 log.Hooks.Add(hook)

 log.WithFields(logrus.Fields{
    "name": "joe",
    "age":  42,
 }).Error("Hello world!")
}
client, err := elastic.NewClient(
    elastic.SetBasicAuth("elastic", "changeme"),
    elastic.SetURL("http://localhost:9200"),
    elastic.SetSniff(false),
)