docker-compose 部署elk,是最简单的方式了
cat docker-compose.yml #创建文件
version: '2.2'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: elasticsearch7.2.0
environment:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
volumes:
- esdata:/usr/share/elasticsearch/data
hostname: elasticsearch
restart: always
ports:
- 9200:9200
- 9300:9300
kibana:
image: docker.elastic.co/kibana/kibana:7.2.0
container_name: kibana7.2.0
environment:
- elasticsearch.hosts=http://elasticsearch:9200
hostname: kibana
depends_on:
- elasticsearch
restart: always
ports:
- "5601:5601"
logstash:
image: docker.elastic.co/logstash/logstash:7.2.0
container_name: logstash7.2.0
hostname: logstash
restart: always
depends_on:
- elasticsearch
ports:
- 9600:9600
- 5044:5044
volumes:
esdata:
driver: local
部署
docker-compose up -d
访问
ip:5601