部署环境:
vim /etc/security/limits.conf
末尾添加内容:
* soft nofile 65536
* hard nofile 65536
* soft nproc 65536
* hard nproc 65536
* soft memlock unlimited
* hard memlock unlimited
vim /etc/security/limits.d/20-nproc.conf
在#* soft nproc 4096下面添加:
* soft nproc 65536
vim /etc/sysctl.conf
末尾添加内容:
fs.file-max=655360
vm.max_map_count=655360
net.ipv4.ip_forward = 1
sysctl -p #使sysctl.conf配置文件生效
docker network create elk-kgc
docker network ls
cd /root/elkf/
cd elasticsearch/
mkdir -p /var/log/elasticsearch
chmod -R 777 /var/log/elasticsearch/
docker build -t elasticsearch .
cd ../kibana/
docker build -t kibana .
cd ../logstash/
mkdir -p /opt/logstash/conf/
chmod -R 777 /opt/logstash/conf/
cp nginx-log.conf /opt/logstash/conf/
docker build -t logstash .
cd ../filebeat/
docker build -t filebeat .
mkdir /var/log/nginx
chmod -R 777 /var/log/nginx
cd ..
cp www.bdqn.cn-access.log /var/log/nginx
docker run -itd -p 80:80 --network elk-kgc -v /var/log/nginx:/var/log/nginx:rw --name nginx-elk nginx:latest
docker run -itd -p 9200:9200 -p 9300:9300 --network elk-kgc -v /var/log/elasticsearch:/var/log/elasticsearch:rw --name elasticsearch elasticsearch
docker run -itd -p 5601:5601 --network elk-kgc --name kibana kibana
docker run -itd -p 5044:5044 --network elk-kgc -v /opt/logstash/conf:/opt/logstash/conf:rw --name logstash logstash
docker run -itd --network elk-kgc -v /var/log/nginx:/var/log/nginx:rw --name filebeat filebeat