简体   繁体   中英

Unable to connect to Elasticsearch in ELK Docker container

I've been following a tutorial ( http://jamesthom.as/blog/2015/07/08/making-logs-awesome-with-elasticsearch-and-docker ) describing how to deploy an ELK (Elasticsearch, Logstash, Kibana) container to Bluemix. I've successfully built the container, and deployed it to the Bluemix registry, but when i start the container and access the Kibana dashboard, I get the following error message: 'Unable to connect to Elasticsearch at http://localhost:9200 .'

Should the Elasticsearch URL be different, and it this is the case, where do I change it?

You can set an environment variable for Elasticsearch Url when you run your Kibana container:

-e ELASTICSEARCH_URL=http://some-elasticsearch:9200

Or you can link your containers with --link parameter :

 --link some-elasticsearch:elasticsearch

And you can find more information from https://hub.docker.com/_/kibana/ or check the following lines:

You can run the default kibana command simply:

$ docker run --link some-elasticsearch:elasticsearch -d kibana

You can also pass in additional flags to kibana:

$ docker run --link some-elasticsearch:elasticsearch -d kibana --plugins /somewhere/else

This image includes EXPOSE 5601 (default port). If you'd like to be able to access the instance from the host without the container's IP, standard port mappings can be used:

$ docker run --name some-kibana --link some-elasticsearch:elasticsearch -p 5601:5601 -d kibana

You can also provide the address of elasticsearch via ELASTICSEARCH_URL environnement variable:

$ docker run --name some-kibana -e ELASTICSEARCH_URL=http://some-elasticsearch:9200 -p 5601:5601 -d kibana

Then, access it via http://localhost:5601 or http://host-ip:5601 in a browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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