2

我正在尝试使用 docker 将 cadvisor 连接到 elasticsearch,但出现错误:

cadvisor.go:113] Failed to initialize storage driver: failed to create the elasticsearch client - no Elasticsearch node available

码头工人-compose.yml

version: '2'
services:
elasticsearch:
    image: "elasticsearch:2.3.3"
    container_name: "elasticsearch"
    ports:
        - "9200:9200"
kibana:
    image: "kibana:4.5.1"
    container_name: "kibana"
    ports:
        - "5601:5601"
    links:
        - elasticsearch
cadvisor:
    image: "google/cadvisor:latest"
    container_name: "cadvisor"
    ports:
        - "8080:8080"
    volumes:
        - /:/rootfs:ro
        - /var/run:/var/run:rw
        - /sys:/sys:ro
        - /var/lib/docker/:/var/lib/docker:ro
    links:
        - elasticsearch
    restart: always
    command: -storage_driver="elasticsearch" -storage_driver_es_host="http://elasticsearch:9200"

如果我将命令更改为

command: -storage_driver="elasticsearch" -storage_driver_es_host="http://172.22.0.5:9200"

一切正常。有任何想法吗?

4

1 回答 1

0

您缺少的是弹性搜索中的索引,不幸的是,这没有很好的记录

转到您的 kibana 仪表板、开发工具并发送此请求:

PUT /.kibana/index-pattern/cadvisor {"title" : "cadvisor", "timeFieldName": "container_stats.timestamp"}

于 2016-11-25T06:36:42.003 回答