一,下载镜像
注意: ELK版本必须最好保持一致
二、安装
1.编写docker-compose.yml配置
version: '2.2'
services:
kibana:
image: kibana:7.17.10
container_name: kibana7
environment:
- I18N_LOCALE=zh-CN
- XPACK_GRAPH_ENABLED=true
- TIMELION_ENABLED=true
- XPACK_MONITORING_COLLECTION_ENABLED="true"
ports:
- 5601:5601
networks:
- elastic
elasticsearch:
image: elasticsearch:7.17.10
container_name: es7
environment:
- node.name=es7
- cluster.name=es-cluster
- discovery.seed_hosts=es7
- cluster.initial_master_nodes=es7
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /container/mnt/elk/elasticsearch/data:/usr/share/elasticsearch/data
ports:
- 9200:9200
- 9300:9300
networks:
- elastic
logstash:
image: logstash:7.17.10
container_name: logstash7
volumes:
- /container/mnt/elk/logstash/config:/usr/share/logstash/config
- /container/mnt/elk/logstash/pipeline:/usr/share/logstash/pipeline
- /container/mnt/elk/logstash/logstash.conf:/usr/share/logstash/logstash.conf
ports:
- 5044:5044
- 9600:9600
networks:
- elastic
networks:
elastic:
driver: bridge
2.编写logstash的pipeline 配置
input {
tcp {
mode => "server"
host => "0.0.0.0"
port => 5044
codec => json_lines
}
}
output {
elasticsearch {
hosts => ["182.109.52.22:9200"]
index => "%{[spring.application.name]}-%{+YYYY.MM.dd}"
}
}
3.启动elk
docker compose up -d
三、查看运行是否正常