在ubuntu中的docker上运行filebeat
我想使用elasticsearch在docker上运行filebeat,但出现以下错误:在ubuntu中的docker上运行filebeat,docker,elasticsearch,kibana,elastic-stack,filebeat,Docker,elasticsearch,Kibana,Elastic Stack,Filebeat,我想使用elasticsearch在docker上运行filebeat,但出现以下错误: sudo docker run docker.elastic.co/beats/filebeat:7.0.0 setup -E setup.kibana.host=localhost:5601 -E output.elasticsearch.hosts=["localhost:9200"] 我没有找到任何有用的解决方案…从容器的角度来看,localhost本身不是正在运行的主机,这就是它无法连接到el
sudo docker run docker.elastic.co/beats/filebeat:7.0.0 setup -E setup.kibana.host=localhost:5601 -E output.elasticsearch.hosts=["localhost:9200"]
我没有找到任何有用的解决方案…从容器的角度来看,
localhost
本身不是正在运行的主机,这就是它无法连接到elasticsearch的原因
您需要在主机网络上运行filebeat容器,或者为其创建一个用户定义的网络,并将filebeat和elasticsearch连接到该网络
例如:
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]
$ 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"]