建立工作目录:/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 的 IP:172.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
上看到官方的 metricbeat
的 dashboard
了。