繁体   English   中英

在ubuntu上的docker上运行filebeat

[英]running filebeat on docker in ubuntu

  sudo docker run docker.elastic.co/beats/filebeat:7.0.0 setup -E setup.kibana.host=localhost:5601 -E output.elasticsearch.hosts=["localhost:9200"]

我想在带有elasticsearch的docker上运行filebeat,但是我收到了这个错误:

Exiting: Couldn't connect to any of the configured Elasticsearch hosts. Errors: [Error connection to Elasticsearch http://localhost:9200: Get http://localhost:9200: dial tcp 127.0.0.1:9200: connect: connection refused]

我找不到任何有用的解决方案......

从容器的角度来看, localhost本身不是运行的主机,这就是它无法连接到elasticsearch的原因。

您需要在主机网络上运行filebeat容器或为其创建用户定义的网络,并将filebeat和elasticsearch连接到该网络。

例:

$ sudo docker network create mynetwork --driver bridge
$ sudo docker run -d -p 9200:9200 -p 9300:9300 --net=mynetwork --name elasticsearch -e "discovery.type=single-node" docker.elastic.co/elasticsearch/elasticsearch:7.0.0
$ sudo docker run -d --name kibana --net=mynetwork -p 5601:5601 kibana:7.0.0
$ sudo docker run --net=mynetwork --name filebeat docker.elastic.co/beats/filebeat:7.0.0 setup -E setup.kibana.host=kibana:5601 -E output.elasticsearch.hosts=["elasticsearch:9200"]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM