0

I followed the accepted answer here How to use the official docker elasticsearch container?

but the kibana UI is not coming up in the browser localhost:5601, what could be the problem?

 [root@localhost ~]# sysctl -w vm.max_map_count=262144
    vm.max_map_count = 262144

 [root@localhost ~]# cat /proc/sys/vm/max_map_count
 262144
 [root@localhost ~]#

error log: docker-compose up

kibana       | {"type":"log","@timestamp":"2020-05-28T02:09:53Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"}
kibana      | {"type":"log","@timestamp":"2020-05-28T02:09:55Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://elasticsearch:9200/"}
kibana      | {"type":"log","@timestamp":"2020-05-28T02:09:55Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}

docker ps :

[root@localhost ~]# docker ps
CONTAINER ID        IMAGE                                                 COMMAND                  CREATED             STATUS              PORTS                                            NAMES
b978841f86d5        docker.elastic.co/elasticsearch/elasticsearch:6.6.1   "/bin/bash bin/es-do…"   14 minutes ago      Up 31 seconds       0.0.0.0:9200->9200/tcp, 0.0.0.0:9300->9300/tcp   elasticsearch
9f255a223659        docker.elastic.co/kibana/kibana:6.6.1                "/bin/sh -c /usr/loc…"   14 minutes ago      Up 31 seconds       0.0.0.0:5601->5601/tcp                           kibana
c21d1a77f25f        mobz/elasticsearch-head:5                             "/bin/sh -c 'grunt s…"   14 minutes ago      Up 31 seconds       0.0.0.0:9100->9100/tcp                           head  

OS: Centos 7

docker: latest

docker-compose: latest

docker-compose.yml

    version: '3'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
    container_name: elasticsearch
    environment:
      - node.name=es01
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      nproc: 65535
      memlock:
        soft: -1
        hard: -1
    cap_add:
      - ALL
    privileged: true
    ports:
      - 9200:9200
      - 9300:9300
    networks:
      - elastic

  kibana:
    image: docker.elastic.co/kibana/kibana-oss:6.6.1
    container_name: kibana
    environment:
      SERVER_NAME: localhost
      ELASTICSEARCH_URL: http://elasticsearch:9200
    depends_on:
      - elasticsearch 
    ports:
      - 5601:5601
    ulimits:
      nproc: 65535
      memlock:
        soft: -1
        hard: -1
    cap_add:
      - ALL
    networks:
      - elastic

network:
  elastic:
    driver: bridge

final capture here after adding the network part (suggested by @Nagle Zhang

On GCP ubuntu 16.04

kko
  • 33
  • 1
  • 8

1 Answers1

0

by the command docker ps , we can tell your service (kibana&es) both worked currectly.

the true problem is you Kibana service can not find Elasticsearch service , because it can not resolve the address http://elasticsearch:9200.

can you share your docker-compose file? I assume it's because of your network in docker-compose is incurrect.

  1. run docker exec -it kibana bash
  2. ping elasticsearch , check if it's working.
  3. exit kibana container , run command docker inspect kibana docker inspect elasticsearch to check if both in a same network.
  4. if it's not, please change the network to code below.

add a network for your container.

version: '3'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.1
    container_name: elasticsearch
    environment:
      - node.name=es01
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      nproc: 65535
      memlock:
        soft: -1
        hard: -1
    cap_add:
      - ALL
    privileged: true
    ports:
      - 9200:9200
      - 9300:9300
    networks:
      - elastic

  kibana:
    image: docker.elastic.co/kibana/kibana-oss:6.6.1
    container_name: kibana
    environment:
      SERVER_NAME: localhost
      ELASTICSEARCH_URL: http://elasticsearch:9200
    depends_on:
      - elasticsearch 
    ports:
      - 5601:5601
    ulimits:
      nproc: 65535
      memlock:
        soft: -1
        hard: -1
    cap_add:
      - ALL
    networks:
      - elastic

network:
  elastic:
    driver: bridge
  • I edited the question, pls check the docker compose file, the same docker can run well on another ubuntu pc but not on centos, I wonder why. I tried all the possible solutions – kko May 28 '20 at 05:16
  • Is elasticsearch running up successfully? – Harshit May 28 '20 at 05:33
  • it's really wired, why you named your container name is elasticsearch & kibana, but your really name is kibana_540 & elasticsearch_540 – Nagle Zhang May 28 '20 at 05:34
  • seems it works , you can tell by `docker ps` , the ealsticsearch status is `up 31 seconds` – Nagle Zhang May 28 '20 at 05:36
  • everything is working fine but kibana cannot connect to ES, @ Nagle Zhang the dockercompose-file.yml is for another attempt, I just changed the name to see if it would work – kko May 28 '20 at 05:39
  • I think you can change `ELASTICSEARCH_URL` from `http://elasticsearch:9200` to `http://elasticsearch_540:9200` temporarily solve the problem. but we need to find out why centos change your container from elasticsearch to elasticsearch_540 – Nagle Zhang May 28 '20 at 05:40
  • @Nagle Zhang the container name should match with the URL so if I change the URL name I have to change the container name as well – kko May 28 '20 at 05:42
  • yeah, now the problem is the URL not match the container_name. ```container_name: elasticsearch_540 URL: http://elasticsearch:9200``` – Nagle Zhang May 28 '20 at 05:47
  • Centos didn't change the image name, the browser is showing `kibana service not ready yet` – kko May 28 '20 at 05:52
  • yes, image name didn't chanted , container name is not currect. run `docker ps`, the last column (NAME) is `elasticsearch_540` which is incurrect. can you check it? – Nagle Zhang May 28 '20 at 05:54
  • I just checked again it elasticsearch and kibana [NAME] – kko May 28 '20 at 05:57
  • I edited everything as I am getting it right now, nothing is working – kko May 28 '20 at 06:09
  • sorry to hear that. please try my new post. see if can helps. – Nagle Zhang May 28 '20 at 06:11
  • I tried now it's saying `elasticsearch | [2020-05-28T06:11:46,893][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [es01] Failed to clear cache for realms [[]] ` – kko May 28 '20 at 06:16
  • can you access kibana now ? https://github.com/elastic/elasticsearch/issues/35218 – Nagle Zhang May 28 '20 at 06:19
  • no only Elastic search, pls check the image link I added – kko May 28 '20 at 06:22
  • the same docker-compose.yml file was running successfully 3 months earlier on ubuntu 16.04, even now I trie, it's still working but not on centos, and I also copied the suggested solution on ubuntu the same error is showing. can you try on your PC or GCP? – kko May 28 '20 at 06:30
  • but this works on my windows 10. so sorry for this, it's too wired, I'm willing to help. but seems unable to do so. – Nagle Zhang May 28 '20 at 06:36
  • by the log, seems elasticsearch is in red status, you can check by running `curl http://localhost:9200/_cat/health`. can you check why? seems now it's a new problem. – Nagle Zhang May 28 '20 at 06:38
  • `curl http://localhost:9200/_cat/health` `1590648183 06:43:03 docker-cluster green 1 1 0 0 0 0 0 0 - 100.0%` – kko May 28 '20 at 06:43
  • I just tried it on GCP using ubuntu 16.04, still getting the same error, check the capture – kko May 28 '20 at 06:44
  • It's working on windows now, sometimes it works and doesn't work on some Linux distros, I didn't change anything tho. What could be the problem? I think there could be other issues that are not linked to the images, better find out. – kko May 29 '20 at 00:58
  • yeah, seems the main reason is beacuse the network(can not resovle) not working , maybe you can check in this way. for example , check /etc/resolve.conf etc. – Nagle Zhang May 29 '20 at 01:31
  • I don't think it's an error related to the docker network because the same code runs elsewhere. maybe the firewall or any other reasons. anyway let's close this. thx @Nagle Zhang – kko May 29 '20 at 02:39