Reputation: 331
I am trying to run Kibana
in Elasticsearch
through a docker-compose
containarized file (.yml
) in a virtual machine, but I am unable to connect to Kibana
and the message that I get while it's unsuccessfully trying to connect is shown below:
[34mspark-master |[0m 18/09/25 17:58:29 INFO master.Master: Registering worker 172.18.0.8:8881 with 2 cores, 1024.0 MB RAM
[36;1mspark-worker |[0m 18/09/25 17:58:29 INFO worker.Worker: Successfully registered with master spark://spark-master:7077
[35mkibana |[0m {"type":"log","@timestamp":"2018-09-25T17:58:31Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"}
[35mkibana |[0m {"type":"log","@timestamp":"2018-09-25T17:58:31Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}
[35mkibana |[0m {"type":"log","@timestamp":"2018-09-25T17:58:33Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"}
[35mkibana |[0m {"type":"log","@timestamp":"2018-09-25T17:58:33Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}
[35mkibana |[0m {"type":"log","@timestamp":"2018-09-25T17:58:36Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"}
[35mkibana |[0m {"type":"log","@timestamp":"2018-09-25T17:58:36Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}
[35mkibana |[0m {"type":"log","@timestamp":"2018-09-25T17:58:38Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"}
[35mkibana |[0m {"type":"log","@timestamp":"2018-09-25T17:58:38Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}
[35mkibana |[0m {"type":"log","@timestamp":"2018-09-25T17:58:41Z","tags":["status","plugin:[email protected]","info"],"pid":1,"state":"green","message":"Status changed from red to green - Ready","prevState":"red","prevMsg":"Unable to connect to Elasticsearch at http://elasticsearch:9200."}
[33melasticsearch |[0m 2018-09-25 17:58:47,078 INFO exited: create-index (exit status 0; expected)
If you notice, docker is able to connect to other services mentioned in the docker-compose file, one of which is spark-master
shown in the first 2 lines. The command to call kibana in the docker-compose file is as follows:
elasticsearch:
build: docker-elasticsearch/
container_name: elasticsearch
hostname: elasticsearch
environment:
- Des.network.host=0.0.0.0
- cluster.name = "elasticsearch"
expose:
- 9200
ports:
- "9200:9200"
kibana:
build: kibana/
container_name: kibana
hostname: kibana
environment:
- SERVER_NAME="kibana"
- SERVER_HOST="0"
- ELASTICSEARCH_URL=http://elasticsearch:9200
ports:
- "5601:5601"
links:
- elasticsearch
depends_on:
- elasticsearch
If I do docker-compose ps
, it gives me following:
Name Command State Ports
--------------------------------------------------------------------------------
elasticsearch /usr/local/bin/docker-entr Up 0.0.0.0:9200->9200/tcp,
... 9300/tcp
kibana /bin/bash /usr/local/bin/k Up 0.0.0.0:5601->5601/tcp
I searched for this issue extensively on google before posting this question here, and tried various suggestions that people had for this issue that included modifying the elasticsearch_url
, such as changing http
to https
, changing localhost
to elasticsearch
and the combination/permutation of these two suggestions, but I was not able to connect to Kibana
using any of the suggestion. It was also suggested somewhere to check the allocated memory for my virtual machine, which for my VM was equal to the value suggested by Elasticsearch
.
On using the commands given by @Ivthillo, it seems Kibana gets connected as shown by the following messages on terminal:
kibana_1 | {"type":"log","@timestamp":"2018-09-26T13:43:05Z","tags":["info","monitoring-ui","kibana-monitoring"],"pid":1,"message":"Starting all Kibana monitoring collectors"}
kibana_1 | {"type":"log","@timestamp":"2018-09-26T13:43:06Z","tags":["license","info","xpack"],"pid":1,"message":"Imported license information from Elasticsearch for the [monitoring] cluster: mode: basic | status: active"}
kibana_1 | {"type":"log","@timestamp":"2018-09-26T13:43:12Z","tags":["listening","info"],"pid":1,"message":"Server running at http://0:5601"}
However, when I try running another service through docker (e.g. sudo docker exec -i
) in a new terminal (becase the above message Server is running at...
remains stuck as it does not move ahead), I get an error indicating container is not running as follows:
Error response from daemon: Container 824846b64950d7e6f38792c5633f9eca3e84702cfe060de012c4fe39cf365ab9 is not running
Upvotes: 4
Views: 9201
Reputation: 461
I have a similar setup. I solved this issue by managing the containers network. Try the following:
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.12
container_name: elasticsearch
environment:
- cluster.name=docker-cluster
ports:
- 9200:9200
kibana:
image: kibana:5.6.12
container_name: kibana
environment:
ELASTICSEARCH_URL: http://elasticsearch1:9200
ports:
- 5601:5601
depends_on:
- elasticsearch
Let me know if this helps.
Upvotes: 1
Reputation: 30723
You can maybe start from this very basic docker-compose, because you are building your own images which makes this hard to debug.
In the example below we start an ES and a Kibana inside the same docker network which means they can access each other using their name. Networking is a better way to make containers communicated than using deprecated --link
.
version: '3.3'
services:
kibana:
image: docker.elastic.co/kibana/kibana:6.3.2
environment:
SERVER_NAME: kibana.example.org
ELASTICSEARCH_URL: http://elasticsearch:9200
ports:
- "5601:5601"
depends_on:
- elasticsearch
networks:
- my-network
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.3.2
container_name: elasticsearch
networks:
- my-network
networks:
my-network:
To prove the connection is working. I'm accessing the kibana container and ping and curl
to my elasticsearch container:
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
7e2632aff839 docker.elastic.co/kibana/kibana:6.3.2 "/usr/local/bin/kiba…" 2 minutes ago Up 2 minutes 0.0.0.0:5601->5601/tcp es_kibana_1
03f2d03a87b4 docker.elastic.co/elasticsearch/elasticsearch:6.3.2 "/usr/local/bin/dock…" 2 minutes ago Up 2 minutes 9200/tcp, 9300/tcp elasticsearch
lorenzvanthillo@MacBook-Pro ~/ES docker exec -it 7e2632aff839 bash
bash-4.2$ ping elasticsearch
PING elasticsearch (172.22.0.2) 56(84) bytes of data.
64 bytes from elasticsearch.es_my-network (172.22.0.2): icmp_seq=1 ttl=64 time=0.554 ms
64 bytes from elasticsearch.es_my-network (172.22.0.2): icmp_seq=2 ttl=64 time=0.075 ms
bash-4.2$ curl http://elasticsearch:9200
{
"name" : "f9AfdJp",
"cluster_name" : "docker-cluster",
"cluster_uuid" : "YQkmS6gtTmqcCs0HgWX5bg",
"version" : {
"number" : "6.3.2",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "053779d",
"build_date" : "2018-07-20T05:20:23.451332Z",
"build_snapshot" : false,
"lucene_version" : "7.3.1",
"minimum_wire_compatibility_version" : "5.6.0",
"minimum_index_compatibility_version" : "5.0.0"
},
"tagline" : "You Know, for Search"
}
Upvotes: 3