Docker 安装ELK

2022-01-13 17:47:28 浏览数 (1)

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

代码语言:javascript复制
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

代码语言:javascript复制
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

代码语言:javascript复制
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

代码语言:javascript复制
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

代码语言:javascript复制
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" ]

0 人点赞