简体   繁体   English

Kibana docker 与外部弹性搜索组合

[英]Kibana docker compose with external elastic search

I've the following docker compose file.我有以下 docker compose 文件。 I'm trying to connect elastic search running in another machine to kibana.我正在尝试将在另一台机器上运行的弹性搜索连接到 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.但是 kibana 一直在尝试连接到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).如何更改 docker compose 文件中的 url(不覆盖 kibana.yml 文件)。

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 .您不需要定义默认端口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 7.5遇到相同问题的Kibana 7.5 ,您必须使用ELASTICSEARCH_HOSTS环境变量而不是ELASTICSEARCH_URL ,如下所示:

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您还可以通过以下链接查阅所有可用环境变量的列表,以及如何在 docker 环境中进行设置: https : //www.elastic.co/guide/en/kibana/7.5/docker.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM