cadvisor,elasticsearch,docker:没有Elasticsearch节点可用

时间:2016-06-04 17:45:01

标签: elasticsearch docker docker-compose cadvisor

我正在尝试使用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"

一切正常。有什么想法吗?

1 个答案:

答案 0 :(得分:0)

你缺少的是elasticsearch中的一个索引,遗憾的是这没有很好的记录

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

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