Home > Software engineering >  port issue for Kibana
port issue for Kibana

Time:05-03

When using default 9200/5601 for ES and Kibana, both ES and Kibana are up.

I'd like to change ports as below. ES is up at http://localhost:34343/ But Kibana doesn't work. I tried both service name ELASTICSEARCH_HOSTS=http://elasticsearch:34343 and container name ELASTICSEARCH_HOSTS=http://my_elasticsearch:34343

version: '3.7'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
    container_name: my_elasticsearch
    environment:
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
      - discovery.type=single-node
    ports:
      - 34343:9200

  kibana:
    image: docker.elastic.co/kibana/kibana:7.16.3

    environment:
      - ELASTICSEARCH_HOSTS=http://elasticsearch:34343
    ports:
      - 5666:5601

I got the error for Kibana

"tags":["error","elasticsearch-service"],"pid":8,"message":"Unable to retrieve version information from Elasticsearch nodes. connect ECONNREFUSED 172.18.0.3:34343"}

CodePudding user response:

Tldr;

I believe you may have made a mistake in you docker-compose file. You are providing Kibana with the port that is mapped on the host 34343 and not the host the service is listening to 9200 in the docker internal network.

Having a read at the networking documentation of docker helped me out

To fix

version: '3.7'
services:
  elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:7.16.3
    container_name: my_elasticsearch
    environment:
      - "ES_JAVA_OPTS=-Xms1g -Xmx1g"
      - discovery.type=single-node
    ports:
      - 34343:9200

  kibana:
    image: docker.elastic.co/kibana/kibana:7.16.3

    environment:
      # - ELASTICSEARCH_HOSTS=http://elasticsearch: 34343
      - ELASTICSEARCH_HOSTS=http://elasticsearch:9200
    ports:
      - 5666:5601
  • Related