Docker 安装ELK

拉取相关镜像,版本号尽量一致

docker pull docker.elastic.co/elasticsearch/elasticsearch:7.14.0
docker pull docker.elastic.co/logstash/logstash:7.14.0
docker pull docker.elastic.co/kibana/kibana:7.14.0

建好文件夹

安装 ElasticSearch

docker run -it -d -p 9200:9200 -p 9300:9300 \
-e  ES_JAVA_OPTS="-Xms512m -Xmx512m" \
-e "discovery.type=single-node" \
--net elastic \
-v /etc/localtime:/etc/localtime:ro \
-v /usr/local/elasticsearch/data:/usr/share/elasticsearch/data \
--name elasticsearch docker.elastic.co/elasticsearch/elasticsearch:7.14.0

安装 kibana

docker run -it -d   --restart=always  \
--name kibana  \
--net elastic \
-p 5601:5601 \
-e "ELASTICSEARCH_HOSTS=http://172.16.2.94:9200" \
docker.elastic.co/kibana/kibana:7.14.0

安装 logstash

docker run -it -d \
--name=logstash \
-p 9600:9600 \
-p 4560:4560 \
-v /usr/local/logstash/config/logstash.yml:/usr/share/logstash/config/logstash.yml \
-v /usr/local/logstash/config/conf.d/:/usr/share/logstash/conf.d/ \
-v /usr/local/logstash/pipeline/:/usr/share/logstash/pipeline/ \
docker.elastic.co/logstash/logstash:7.14.0

修改配置
vim /usr/local/logstash/config/logstash.yml

http.host: "0.0.0.0"
# xpack.monitoring.elasticsearch.hosts: [ "http://172.16.2.94:9200" ]
monitoring.elasticsearch.hosts: [ "http://172.16.2.94:9200" ]


你可能感兴趣的:(ElasticSearch,docker,elk,elasticsearch)