1.安装docker
##安装依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
##添加软件源
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
##安装docker
yum install -y docker-ce
2.启动docke并拉取运行容器
[root@db02 ~]# systemctl start docker ##启动docker
[root@db02 ~]# docker pull nginx ##拉取nginx镜像
[root@db02 ~]# docker run --name nginx -p 80:80 --restart=always -d nginx ##运行容器
3.用浏览器访问容器测试
访问成功
4.修改配置文件
[root@db02 ~]# vim /etc/filebeat/filebeat.yml
filebeat.inputs:
- type: docker
containers.ids:
- '4223b359fd5690bec5d99ad46bb28cba2412673f25cb1570463da5d7c890ef9e'
setup.kibana:
host: "172.16.210.53:5601"
output.elasticsearch:
hosts: ["172.16.210.53:9200"]
index: "docker-%{[beat.version]}-%{+yyyy.MM}"
setup.template.name: "docker"
setup.template.pattern: "docker-*"
setup.template.enabled: false
setup.template.overwrite: true
5.重启filbebeat
[root@db02 ~]# systemctl restart filebeat