DOCKER ELK

建立工作目录:/data/docker

elk-master
├── docker-compose.yml
├── elasticsearch
│   ├── config
│   │   └── elasticsearch.yml
│   └── Dockerfile
├── extensions
│   ├── logspout
│   │   ├── build.sh
│   │   ├── Dockerfile
│   │   ├── logspout-compose.yml
│   │   ├── modules.go
│   │   └── README.md
│   └── README.md
├── kibana
│   ├── config
│   │   └── kibana.yml
│   └── Dockerfile
├── LICENSE
├── logstash
│   ├── config
│   │   └── logstash.yml
│   ├── Dockerfile
│   └── pipeline
│       └── logstash.conf
├── metricbeat
│   ├── config
│   │   └── metricbeat.yml
│   └── Dockerfile
└── README.md

docker-compose.yml 文件:

version: '3.6'

services:

  elasticsearch:
    build:
      context: elasticsearch/
    volumes:
      - ./elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml:ro
    ports:
      - "9200:9200"
      - "9300:9300"
    environment:
      ES_JAVA_OPTS: "-Xmx256m -Xms256m"
    networks:
      - elk

  logstash:
    build:
      context: logstash/
    volumes:
      - ./logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml:ro
      - ./logstash/pipeline:/usr/share/logstash/pipeline:ro
    ports:
      - "5000:5000"
    environment:
      LS_JAVA_OPTS: "-Xmx256m -Xms256m"
    networks:
      - elk
    depends_on:
      - elasticsearch

  kibana:
    build:
      context: kibana/
    volumes:
      - ./kibana/config/:/usr/share/kibana/config:ro
    ports:
      - "5601:5601"
    networks:
      - elk
    depends_on:
      - elasticsearch

  heartbeat:
    image: docker.elastic.co/beats/heartbeat:6.2.4
    networks:
      - elk
    depends_on:
      - elasticsearch

  packetbeat:
    image: docker.elastic.co/beats/packetbeat:6.2.4
    networks:
      - elk
    depends_on:
      - elasticsearch

  metricbeat:
    build:
      context: metricbeat/
    volumes:
      - ./metricbeat/config/metricbeat.yml:/usr/share/metricbeat/config/metricbeat.yml:ro
    networks:
      - elk
    depends_on:
      - elasticsearch

networks:

  elk:

    driver: bridge

启动elk容器

docker-compose up

查看 kibana 的 IP172.18.0.7

进入 metricbeat 容器

docker exec -it [YOUR CONTAINER ID] /bin/bash

进入目录:cd /usr/share/metricbeat

执行命令加载 Dashboard

./metricbeat setup -E setup.kibana.host=172.18.0.7:5601

这样就可以在 kibana 上看到官方的 metricbeatdashboard 了。

    原文作者:vboy1010
    原文地址: https://segmentfault.com/a/1190000015229682
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞