简体   繁体   中英

Kibana docker compose with external elastic search

I've the following docker compose file. I'm trying to connect elastic search running in another machine to kibana.

version: '3.3'

services:

  kibana_ci:
    image: docker.elastic.co/kibana/kibana:6.3.2
    environment:
      ELASTICSEARCH_URL: http://my_domain:9200
    container_name: kibana_ci
    command: kibana
    ports:
      - "5601:5601"

But kibana is keep trying to connect to http://elasticsearch:9200/ url. I've also tried with following options which didnt work.

    environment:
      - "ELASTICSEARCH_URL=http://my_domain:9200"
    environment:
      - "KIBANA_ELASTICSEARCH_URL=http://my_domain:9200"
    environment:
      KIBANA_ELASTICSEARCH_URL: http://my_domain:9200
    environment:
      elasticsearch.url: http://my_domain:9200

How can I change the url in docker compose file (without overriding kibana.yml file).

This compose file works for me:

version: '3.3'
services:
  kibana:
    image: docker.elastic.co/kibana/kibana:6.3.2
    environment:
      SERVER_NAME: kibana.example.org
      ELASTICSEARCH_URL: http://my_domain

You don't need to define default port 9200 .

kibana_1  | {"type":"log","@timestamp":"2018-09-20T16:58:31Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://my_domain:9200/"}
kibana_1  | {"type":"log","@timestamp":"2018-09-20T16:58:31Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}
kibana_1  | {"type":"log","@timestamp":"2018-09-20T16:58:34Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"Unable to revive connection: http://my_domain:9200/"}
kibana_1  | {"type":"log","@timestamp":"2018-09-20T16:58:34Z","tags":["warning","elasticsearch","admin"],"pid":1,"message":"No living connections"}

For those who will face the same issue in Kibana 7.5 , you will have to use the ELASTICSEARCH_HOSTS environment variable instead of ELASTICSEARCH_URL , like below:

kibana:
    image: docker.elastic.co/kibana/kibana:7.5.2
    container_name: kibana
    environment:
      ELASTICSEARCH_HOSTS: http://es01:9200
    ports:
      - 5601:5601
    depends_on:
      - es01
    networks:
      - elastic

You can also consult via the following link the list of all environment variables available, and how to setup in a docker environment: https://www.elastic.co/guide/en/kibana/7.5/docker.html

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