dockerelasticsearchelastic-stackfilebeatelastic-beats

Running filebeat setup fails


I installed Elasticsearch and Kibana on docker. I need to add Filebeat to the workflow, so I followed the official documentation Run filebeat setup

I run this command:

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

But I got this error :

Exiting: couldn't connect to any of the configured Elasticsearch hosts. Errors: [error connecting to Elasticsearch at https://127.0.0.1:9200/: Get "https://127.0.0.1:9200/": dial tcp 127.0.0.1:9200: connect: connection refused]

I'm working with the current version of ELK.


Solution

  • I resolved this problem, first I checked elasticsearch.yml and kibana.yml, I notice that the host address are not localhost,I also inspected both of the containers "KIBANA and ELASTIC" detail's and I found that they are pointing to the same host as yml file.

    So run the command with the host adresses from the containers detail's and it worked :

    docker run --net elastic -it docker.elastic.co/beats/filebeat:8.1.2  setup -E setup.kibana.host=172.18.0.3:5601 -E output.elasticsearch.hosts=["172.18.0.2:9200"]