3.5、设置目录权限
三台服务器一样
代码语言:javascript复制sudo chmod g rwx /work/elk/elasticsearch/data
sudo chown 1000 /work/elk/elasticsearch/data
sudo chmod g rwx /work/elk/elasticsearch/logs
sudo chown 1000 /work/elk/elasticsearch/logs
3.6、启动应用
三台服务器一样
代码语言:javascript复制/work/elk/elasticsearch/bin/start.sh
四、安装kibana
kibana可以值部署一个节点,如需要部署多个节点,过程完全一样
4.1、创建目录
主机:172.30.9.227
代码语言:javascript复制mkdir -p /work/elk/kibana/{bin,data,conf,logs}
4.2、编辑启动脚本
主机:172.30.9.227
代码语言:javascript复制vim /work/elk/kibana/bin/start.sh
代码语言:javascript复制#!/bin/bash
docker run -d -p 5601:5601 --name kibana
--restart=always
--log-opt max-size=10m
-v /etc/localtime:/etc/localtime:ro
-v /etc/timezone:/etc/timezone
-v /work/elk/kibana/conf/kibana.yml:/usr/share/kibana/config/kibana.yml
-v /work/elk/kibana/logs:/var/log/kibana/
kibana:7.5.1
代码语言:javascript复制chmod 755 /work/elk/elasticsearch/bin/start.sh
4.3、编辑配置文件
主机:172.30.9.227
代码语言:javascript复制vim /work/elk/kibana/conf/kibana.yml
代码语言:javascript复制server.name: kibana
server.host: "0.0.0.0"
elasticsearch.hosts: ["http://172.30.9.227:9200","http://172.30.9.209:9200","http://172.30.9.218:9200"]
logging.dest: /var/log/kibana/kibana.log
i18n.locale: "zh-CN"
xpack.monitoring.ui.container.elasticsearch.enabled: true
4.4、启动应用
主机:172.30.9.227
代码语言:javascript复制/work/elk/kibana/bin/start.sh
五、安装Logstash
三台服务器一样
5.1、创建目录
代码语言:javascript复制mkdir -p /work/elk/logstash/{bin,data,conf,logs}
5.2、编辑启动脚本
代码语言:javascript复制vim /work/elk/logstash/bin/start.sh
代码语言:javascript复制#!/bin/bash
docker run -d -p 5044:5044 --name=logstash
--restart=always
--log-opt max-size=10m
-v /etc/localtime:/etc/localtime:ro
-v /etc/timezone:/etc/timezone
-v /work/elk/logstash/conf/logstash.yml:/usr/share/logstash/config/logstash.yml
-v /work/elk/logstash/conf/logstash.conf:/usr/share/logstash/pipeline/logstash.conf
logstash:7.5.1
代码语言:javascript复制chmod 755 /work/elk/logstash/bin/start.sh
5.3、编辑配置文件
代码语言:javascript复制vim /work/elk/logstash/conf/logstash.conf
代码语言:javascript复制input {
beats {
port => "5044"
}
}
filter {
json {
source => "message"
remove_field => ["message"]
}
}
output {
elasticsearch {
hosts => ["172.30.9.227:9200","172.30.9.209:9200","172.30.9.218:9200"]
index => "logstash-%{ yyyy.MM.dd}"
}
}
代码语言:javascript复制vim /work/elk/logstash/conf/logstash.yml
代码语言:javascript复制http.host: "0.0.0.0"
xpack.monitoring.elasticsearch.hosts: [ "172.30.9.227:9200","172.30.9.209:9200","172.30.9.218:9200" ]
5.4、启动应用
代码语言:javascript复制/work/elk/logstash/bin/start.sh