简体   繁体   中英

warning: kibana Unable to connect to Elasticsearch at http://elasticsearch:9200

I put the ip address of elasticsearch container in elasticsearch_url / and I tried also to use elasticsearch_url: http://localhost:9200 but I got the same warrning: knowing that : I could access to the Dashboard of kibana And when I did curl "http:/IP_addres_of_the_container_elk:9200

{
  "name" : "qgn5tIw",
  "cluster_name" : "docker-cluster",
  "cluster_uuid" : "UxAne7DGT6-lF9yp7hadYw",
  "version" : {
    "number" : "6.2.4",
    "build_hash" : "ccec39f",
    "build_date" : "2018-04-12T20:37:28.497551Z",
    "build_snapshot" : false,
    "lucene_version" : "7.2.1",
    "minimum_wire_compatibility_version" : "5.6.0",
    "minimum_index_compatibility_version" : "5.0.0"
  },
  "tagline" : "You Know, for Search"
}

this is my docker-compose :

---
version: '2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.2.4
    container_name: elasticsearch
    hostname: elasticsearch
    environment:
      - http.port=9200
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
      - discovery.zen.minimum_master_nodes=1
      - discovery.type=single-node
      - cluster.routing.allocation.disk.threshold_enabled=false
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
  kibana:
    image: docker.elastic.co/kibana/kibana-oss:6.2.4
    environment:
      - elasticsearch_url= http://172.18.0.2:9200
      - verify_ssl= false
    volumes:
      - esdata2:/usr/share/kibana/config/data
    ports:
     - 5601:5601
    depends_on
     - elasticsearch
volumes:
  esdata1:
    driver: local
  esdata2:
    driver: local

Could any one help please ? did I miss something ?

You have to add elasticsearch container as a link

kibana:
    image: docker.elastic.co/kibana/kibana-oss:6.2.4
    environment:
      - elasticsearch_url= http://172.18.0.2:9200
      - verify_ssl= false
    volumes:
      - esdata2:/usr/share/kibana/config/data
    ports:
      - 5601:5601
    depends_on
      - elasticsearch
    links:
      - elasticsearch

Creating a docker network should solve the problem. It may give you the warning at the startup, but I believe it is normal. Wait a couple of seconds and it will connect.

Lastly, as others stated, do not hardcode the IP.

Try the following :

version: '2.2'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
    container_name: elasticsearch
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata1:/usr/share/elasticsearch/data
    ports:
      - 9200:9200
    networks:
      - esnet
  elasticsearch2:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.2.4
    container_name: elasticsearch2
    environment:
      - cluster.name=docker-cluster
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
      - "discovery.zen.ping.unicast.hosts=elasticsearch"
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - esdata2:/usr/share/elasticsearch/data
    networks:
      - esnet
  kibana:
    image: docker.elastic.co/kibana/kibana:6.2.4
    container_name: kibana
    ports:
      - 5601:5601
    networks:
      - esnet
    depends_on:
        - elasticsearch     

volumes:
  esdata1:
    driver: local
  esdata2:
    driver: local

networks:
  esnet:

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