简体   繁体   中英

Kibana can't reach elasticsearch

Using docker-compose v3 and deploying to a swarm:

version: '3'
services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.4.1
    deploy:
      replicas: 1
    ports:
     - "9200:9200"
    tty: true


  kibana:
    image: docker.elastic.co/kibana/kibana:5.4.1
    deploy:
      mode: global
    ports:
     - "5601:5601"
    depends_on:
      - elasticsearch
    tty: true

I see this in the kibana service log:

Unable to revive connection: http://elasticsearch:9200/

Elasticsearch service is running and can be reached. Swarm consists of 3 nodes.

What am I missing?

Update: I turns out that if I try to access kibana on the same swarm node where elasticsearch is running, it works. All other nodes either have a network problem or cannot resolve the elasticsearch name.

Docker-compose by default generates a network and puts all services within it. But I do not know if it changes in docker swarm. To define it you can do this.

version: '3'
services:

  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:5.4.1
    deploy:
      replicas: 1
    ports:
     - "9200:9200"
    tty: true
    networks:
      - some-name


  kibana:
    image: docker.elastic.co/kibana/kibana:5.4.1
    deploy:
      mode: global
    ports:
     - "5601:5601"
    links:
      - elasticsearch
    depends_on:
      - elasticsearch
    tty: true
    networks:
      - some-name

networks:
  some-name:
  driver: overlay

I hope it serves you, I will wait for news.

I found the reason, and the solution. My swarm is running on AWS - All nodes are placed in the same security group and I assumed all ports were open internally in that security group. That's not the case. I explicitly configured the security group to allow inbound traffic as per dockers routing mesh specs here: https://docs.docker.com/engine/swarm/ingress/

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