建行官方网站 - 百度,wordpress的文件说明,做一个自己的免费网站吗,网页设计计划怎么写软件说明#xff1a;
所有软件包下载地址#xff1a;Past Releases of Elastic Stack Software | Elastic
打开页面后选择对应的组件及版本即可#xff01;
所有软件包名称如下#xff1a;
架构拓扑#xff1a; 集群模式#xff1a; 单机模式
架构规划#xff1a…软件说明
所有软件包下载地址Past Releases of Elastic Stack Software | Elastic
打开页面后选择对应的组件及版本即可
所有软件包名称如下
架构拓扑 集群模式 单机模式
架构规划 集群模式
角色主机名IP地址图形展示kibana192.168.166.111日志存储es1192.168.158.6es2192.168.166.113es3192.168.166.114日志收集分析lostash1192.168.166.166lostash2192.168.166.116lostash3192.168.166.117日志采集access、error192.168.166.118 单机模式 角色主机名IP地址图形展示kibana192.168.166.111日志存储es192.168.158.6日志收集分析lostash192.168.166.113日志采集access、error192.168.166.114 说明以下部署过程为单机模式部署集群模式请自行修改部署
一、 Elasticsearch安装与配置
修改主机名
[rootlocalhost ~]# hostnamecl set-hostname es
[rootlocalhost ~]# bash
[rootes ~]#
配置主机名解析
[rootes ~]# cat /etc/hosts
192.168.166.111 kibana
192.168.158.6 es
192.168.166.113 logstash
192.168.166.114 nginx
时间同步
[rootelk ~]# vim /etc/chrony.conf server ntp.aliyun.com iburst[rootelk ~]# systemctl restart chronyd.service
[rootelk ~]# date
2025年 07月 16日 星期三 20:48:10 CST 安装JAVA8
[rootes ~]# yum install -y java
Rocky8 yum安装版本为java-1.8.0-openjdk
将elasticsearch软件包拷贝至elk主机执行安装
[rootes ~]# yum localinstall -y elasticsearch-7.1.1-x86_64.rpm#安装软件包需要的依赖 配置elasticsearch
[rootes ~]# cd /etc/elasticsearch/
[rootes elasticsearch]# cat elasticsearch.yml | grep -Ev ^#
cluster.name: my-application #集群名称
node.name: es #节点主机名
path.data: /var/lib/elasticsearch #数据存放目录
path.logs: /var/log/elasticsearch #日志存放目录
network.host: 192.168.158.6 #监听IP地址
http.port: 9200 #监听端口号
cluster.initial_master_nodes: [es] #主节点
http.cors.enabled: true
http.cors.allow-origin: *
#####集群模式下修改为如下配置
cluster.name: my-application #集群名称
node.name: es #节点主机名
path.data: /var/lib/elasticsearch #数据存放目录
path.logs: /var/log/elasticsearch #日志存放目录
network.host: 192.168.158.6 #监听IP地址
http.port: 9200 #监听端口号
http.cors.enabled: true #跨域访问
http.cors.allow-origin: * #跨域访问
cluster.initial_master_nodes: [192.168.158.6,192.168.166.113,192.168.166.114] #主节点
discovery.zen.ping.unicast.hosts: [192.168.158.6, 192.168.166.113, 192.168.166.114] # 配置自动发现
discovery.zen.minimum_master_nodes: 2 #防止集群“脑裂”需要配置集群最少主节点数目通常为 (主节点数目/2) 1
启动elasticsearch服务并设置开机自启动
[rootes ~]# systemctl start elasticsearch.service
[rootes ~]# systemctl enable elasticsearch.service实验环境开机自启会占用大量内存易卡顿这里仅启动
验证启动结果
[rootes ~]# systemctl status elasticsearch.service
[rootes ~]# ss -antl|grep 9200 二、 logstash安装与配置
修改主机名
[rootlocalhost ~]# hostnamecl set-hostname logstash
[rootlocalhost ~]# bash
[rootlogstash ~]#
配置主机名解析
[rootlogstash ~]# cat /etc/hosts
192.168.166.111 kibana
192.168.158.6 es
192.168.166.113 logstash
192.168.166.114 nginx
安装JAVA8系统自带
[rootlogstash ~]# yum install -y java
将logstash软件包拷贝至elk主机执行安装
[rootlogstash ~]# yum localinstall -y logstash-7.1.1.rpm
优化logstash命令
[rootlogstash ~]# ln -s /usr/share/logstash/bin/logstash /usr/local/bin/
配置logstash
[rootlogstash ~]# cd /etc/logstash/
[rootlogstash logstash]# cat logstash.yml
path.data: /var/lib/logstash #数据存储路径
http.host: 192.168.166.113 #监听地址
http.port: 9600-9700 #监听端口范围
path.logs: /var/log/logstash #日志存储路径 测试logstash服务的数据传输
##标准输入与输出
[rootlogstash ~]# logstash -e input{ stdin{} }output { stdout{} }
##使用rubydebug解码
[rootlogstash ~]# logstash -e input { stdin{} } output { stdout{ codecrubydebug }}
##输出到elasticsearch
[rootlogstash ~]# logstash -e input { stdin{} } output { elasticsearch{ hosts[192.168.158.6:9200]} }
创建配置文件
[rootlogstash ~]# cd /etc/logstash/conf.d/logstash/conf.d
[rootlogstash ~]# cat pipline.conf
input {beats {port 5044}
}
output {if access in [tags] {elasticsearch {hosts [192.168.158.6:9200]index access-%{YYYY.MM.dd}}}if error in [tags] {elasticsearch {hosts [192.168.158.6:9200]index error-%{YYYY.MM.dd}}}
###日志进行标准输出观察日志获取的过程###stdout {codec rubydebug}
}
#####集群模式下修改问如下配置
input {beats {port 5044}
}
output {if access in [tags] {elasticsearch {hosts [192.168.158.6:9200]index access-%{YYYY.MM.dd}}}if error in [tags] {elasticsearch {hosts [192.168.158.6:9200]index error-%{YYYY.MM.dd}}} ###日志进行标准输出观察日志获取的过程### stdout {codec rubydebug}
}
启动logstash服务
[rootlogstash ~]# logstash -f /etc/logstash/conf.d/pipline.conf
三、 nginx、filebeat安装与配置
修改主机名
[rootlocalhost ~]# hostnamecl set-hostname nginx
[rootlocalhost ~]# bash
[rootnginx ~]#
配置主机名解析
[rootlogstash ~]# cat /etc/hosts
192.168.166.111 kibana
192.168.158.6 es
192.168.166.113 logstash
192.168.166.114 nginx
nginx安装与启动
[rootnginx ~]# yum install -y epel-release
[rootnginx ~]# yum install -y nginx
[rootnginx ~]# systemctl start nginx
filebeat安装
[rootnginx ~]# yum localinstall -y filebeat-7.1.1-x86_64.rpm
filebeat配置项
[rootnginx ~]# cd /etc/filebeat
[rootnginx ~]# cat filebeat.yml
配置项作用filebeat.inputs输入配置块用于指定 Filebeat 应该监听哪些文件并将其作为输入。你可以指定文件路径、文件类型、文件格式等。filebeat.prospectors这是一种更灵活的输入方式它允许你同时监听多个目录或文件系统中的多个文件。它结合了输入和输出配置项使得配置更加灵活。filebeat.config用于加载和执行自定义的配置文件。你可以使用此选项加载其他 YAML 文件以便在 Filebeat 中使用自定义规则和插件。output.elasticsearch输出配置块用于将日志数据发送到 Elasticsearch。你可以指定 Elasticsearch 的地址、端口、索引名称等。output.logstash输出配置块用于将日志数据发送到 Logstash。你可以指定 Logstash 的地址、端口、输入格式等。filebeat.harvesterHarvester 是 Filebeat 的核心组件之一负责监听文件并将其拆分为事件。你可以通过配置项来调整 Harvester 的行为例如事件级别、分隔符等。filebeat.scannerScanner 负责定期扫描指定路径中的新文件并触发事件收集。你可以通过配置项来调整 Scanner 的行为例如扫描频率、延迟等。filebeat.processor处理器用于对收集到的日志事件进行处理和解析。你可以使用内置的处理器类型如过滤器、映射器等来对事件进行过滤、转换和编码。filebeat.registry注册表用于存储 Filebeat 的配置信息、事件数据和资源状态。你可以通过配置项来调整注册表的行为和存储方式。 日志收集
filebeat 7.1以上支持模版收集日志和传统方式收集日志具体每个方式的配置如下
1、 采用filebeat的nginx模块收集nginx日志
##filebeat模块操作命令
#查看支持的模块
[rootnginx ~]# filebeat modules list
#启用nginx模块
[rootnginx ~]# filebeat modules enable nginx
#配置nginx模块
[rootnginx ~]# cd /etc/filebeat/modules.d
[rootnginx ~]# cat nginx.yml
- module: nginx# Access logsaccess:enabled: truevar.paths: [/var/log/nginx/access.log]# Error logserror:enabled: truevar.paths: [/var/log/nginx/error.log]
#################测试配置文件
[rootlocalhost ~]# filebeat test config -e
2、传统方式收集
【输出给logstash】
[rootlocalhost ~]# cat /etc/filebeat/filebeat.yml
filebeat.inputs:
- type: logenabled: truepaths:- /var/log/access/*.logtags: nignx1
- type: logenabled: truepaths:- /var/log/error/*.logtags: nignx2
output.logstash:hosts: [192.168.166.113:5044]
#################测试配置文件
[rootlocalhost ~]# filebeat test config -e
【输出给elasticsearch】
[rootlocalhost ~]# cat /etc/filebeat/filebeat.yml
filebeat.inputs:
- type: logenabled: truepaths:- /var/log/nginx/access.log- /var/log/nginx/error.log
output.elasticsearch:# Array of hosts to connect to.hosts: [192.168.166.129:9200]index: nginx-access-%{[host.name]}-%{yyyy.MM.dd}# 自定义索引名称
setup.ilm.enabled: false # 索引生命周期 ilm 功能默认开启开启情况下索引名称只能为 filebeat-*
setup.template.name: nginx1 # 定义模板名称
setup.template.pattern: nginx1-* # 定义模板的匹配索引名称
#####产生不同索引的方法#####
output.elasticsearch:# Array of hosts to connect to.hosts: [192.168.166.22:9200]indices:- index: nginx1-access-logswhen:contains:{ message: GET}- index: nginx1-error-logswhen:contains:{ message: error }
setup.ilm.enabled: false
setup.template.name: nginx1
setup.template.pattern: nginx1-*
#################测试配置文件[rootlocalhost ~]# filebeat test config -e
启动filebeat
[rootnginx ~]# systemctl start filebeat
[rootnginx ~]# systemctl enabled filebeat
es续期 curl -XPosT http://192.168.88.133:9200/_license/start_trial?acknowledgetrue
四、 Kibana安装与配置
修改主机名
[rootlocalhost ~]# hostnamecl set-hostname logstash
[rootlocalhost ~]# bash
[rootlogstash ~]#
配置主机名解析
[rootlogstash ~]# cat /etc/hosts
192.168.166.111 kibana
192.168.158.6 elk
192.168.166.113 logstash
192.168.166.114 nginx
192.168.166.166 tomcat
192.168.166.116 mysql
安装JAVA8
[rootlogstash ~]# yum install -y java
将logstash软件包拷贝至elk主机执行安装
[rootlogstash ~]# yum localinstall -y kibana-7.1.1-x86_64.rpm
配置kibana
[rootkibana]# cd /etc/kibana/
[rootkibana kibana]# cat kibana.yml
server.port: 5601 #监听端口
server.host: 192.168.166.111 #监听地址
server.name: kibana #主机名
elasticsearch.hosts: [http://192.168.158.6:9200] #连接的elasticsearch服务器
kibana.index: .kibana #kibana的索引
i18n.locale: zh-CN #汉化
##集群模式下配置
server.port: 5601 #监听端口
server.host: 192.168.166.111 #监听地址
server.name: kibana #主机名
elasticsearch.hosts: [http://192.168.158.6:9200,http://192.168.166.113:9200,http://192.168.166.114:9200] #连接的elasticsearch服务器
kibana.index: .kibana #kibana的索引
i18n.locale: zh-CN #汉化 访问kibana
#在浏览器中输入
http://192.168.166.111:5601
创建索引
创建筛选
添加仪表盘