0
点赞
收藏
分享

微信扫一扫

Centos 7.5 elasticsearc 7.4.2 ELK 之logstash-filebeat-kibana7.4.2安装设置

版本依赖查询地址
https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html
各版本软件下载地址
https://www.elastic.co/cn/downloads/past-releases
https://elasticsearch.cn/download/
本实验使用
logstash-7.4.2.tar.gz
filebeat-7.4.2-linux-x86_64.tar.gz
kibana-7.4.2-linux-x86_64.tar.gz

一、环境准备

1、服务器准备及规划 CENTOS 7.5最小化安装

10.10.201.155 node-1 安装 elasticsearch-7.4.2 (上一篇已经安装)

10.10.201.158 安装 logstash-7.4.2

10.10.201.178 安装 filebeat-7.4.2

10.10.201.153 安装 kibana-7.4.2

2.关闭防火墙和selinux 所有服务器

1.
systemctl stop firewalld
systemctl disable firewalld
2.
vim /etc/selinux/config
更改为如下
SELINUX=disable
从启动计算机

3、服务器时间一致设置 所有服务器

1.修改时区
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

2.刷新
hwclock -w
3.安装ntpdate并校准时间
yum -y install ntpdate ; ntpdate time.windows.com

4.安装jdk 和一些软件 所有服务器

yum -y install java-1.8.0-openjdk 
yum install -y unzip zip
yum -y install vim*
yum -y install git

5.开始安装logstash 10.10.201.158服务器

1.建立一个存放软件的目录 并把logstash-7.4.2.tar.gz 上传至此目录
mkdir -p /home/xiazai
cd /home/xiazai
2.建立logstash软件安装的目录
mkdir -p /usr/local/logstash
3.将logstash解压缩至/usr/local/logstash目录
cd /home/xiazai
tar zxvf logstash-7.4.2.tar.gz -C /usr/local/logstash/
4.进入目录
cd /usr/local/logstash/logstash-7.4.2/bin
5.测试运行
./logstash -e 'input { stdin { } } output { stdout { } }'
等待后
显示如下 证明启动成功
Successfully started Logstash API endpoint {:port=>9600}
6.hello world 测试一下
输入 hello world
显示如下
{
"message" => "hello world",
"@timestamp" => 2022-03-30T02:54:13.340Z,
"host" => "localhost.localdomain",
"@version" => "1"
安装完成 可以正常启动

先杀掉刚刚启动的进程 继续后面的设置
# 查看进程号
ps -ef|grep logstash

# 杀死进程
kill -9 XXXX

6.配置logstash 10.10.201.158

1.建立logstash配置文件
cd /usr/local/logstash/logstash-7.4.2/config
vim logstash.conf
如下:

# Sample Logstash configuration for creating a simple
# Beats -> Logstash -> Elasticsearch pipeline.

input {
beats {
port => 5044
}
}


#output {
# stdout { codec => rubydebug }
#}



output {
elasticsearch {
hosts => ["10.10.201.154:9200"]
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
#user => "elastic"
#password => "changeme"
}
}

保存退出

2.启动服务

启动服务
[root@localhost logstash-7.4.2]# ./bin/logstash -f ./config/logstash.conf
启动服务并自动刷新
[root@localhost logstash-7.4.2]# ./bin/logstash -f ./config/logstash.conf --config.reload.automatic
后台启动
[root@localhost logstash-7.9.2]# nohup ./bin/logstash -f ./config/logstash.conf &

7.开始安装filebeat 10.10.201.178服务器

1.把filebeat-7.4.2-linux-x86_64.tar.gz 上传至下面目录
cd /home/xiazai/

2.建立filebeat安装的目录
mkdir -p /usr/local/filebeat

3.解压缩至文件/usr/local/filebeat
tar zxvf filebeat-7.4.2-linux-x86_64.tar.gz -C /usr/local/filebeat/

8.配置filebeat 10.10.201.178服务器

1.进入安装的目录
cd /usr/local/filebeat

2.编辑主配置文件
vim /usr/local/filebeat/filebeat-7.4.2-linux-x86_64/filebeat.yml

配置如下:
数据输入的设置
1.改为true
enabled: true
2.写你的log目录
paths:
- /home/log/*.log

数据输出设置
1.注释掉下面的 我们不使用输出到elasticsearch 我们要输出到刚刚安装的logstash上
#output.elasticsearch:
# Array of hosts to connect to.
#hosts: ["localhost:9200"]
2,取消注释并更改为自己的logstash服务器IP
output.logstash:
# The Logstash hosts
hosts: ["10.10.201.158:5044"]

一、 在前台启动
./filebeat -e -c filebeat.yml
二、在后端启动
nohup ./filebeat -e -c filebeat.yml &

9.安装kibana 10.10.201.153服务器

1.解压缩至/usr/local/kibana目录

tar -xzf kibana-7.4.2-linux-x86_64.tar.gz

2.拷贝到/usr/local/kibana/目录

cp -r kibana-7.4.2-linux-x86_64 /usr/local/kibana/

3.进入配置文件目录

cd /usr/local/kibana/kibana-7.4.2-linux-x86_64/config

4.配置主配置文件

vim /usr/local/kibana/kibana-7.4.2-linux-x86_64/config/kibana.yml

配置如下

server.host: 0.0.0.0

elasticsearch.hosts: ["http://10.10.201.154:9200"]

i18n.locale: "zh-CN"

5.启动服务
进入目录
cd /usr/local/kibana/kibana-7.4.2-linux-x86_64/bin
启动服务
./kibana --allow-root

全部完成



举报

相关推荐

0 条评论