FreezeJ' Blog

Centos7使用yum部署elastic stack8

2022-03-21

8.x的版本比目前还是比较新,刚发布不久,部署只用作预览新功能,线上部署请查看组件兼容性:https://www.elastic.co/cn/support/matrix#matrix_compatibility

不建议这样直接yum安装

新手可以使用这种方式快速部署,我刚刚接触学习的时候也是使用yum安装,但是这样的弊端是配置文件分散,升级、删除不方便,例如,一个机器上需要部署多个filebeat,配置文件就会很混乱。
推荐使用tar包解压到data目录下部署,目录下包含输出的日志、配置文件、启动脚本等。

Elasticsearch

最新官网下载地址:https://www.elastic.co/cn/downloads/elasticsearch

# 插入reop文件
cat << EOF > /etc/yum.repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md
EOF

# 开始安装
sudo yum install --enablerepo=elasticsearch elasticsearch

# 设置开机启动
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service

# 开启服务
sudo systemctl start elasticsearch.service

Logstash

最新官网下载地址:https://www.elastic.co/cn/downloads/logstash

# 安装GPG-KEY
sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

# 插入reop文件
cat << EOF > /etc/yum.repos.d/logstash.repo
[logstash-8.x]
name=Elastic repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

# 开始安装
sudo yum install logstash

# 设置开机启动
sudo systemctl daemon-reload
sudo systemctl enable logstash.service

# 开启服务
sudo systemctl start logstash.service

kibana

最新官网下载地址:https://www.elastic.co/cn/downloads/kibana

# 插入reop文件
cat << EOF > /etc/yum.repos.d/kibana.repo
[kibana-8.x]
name=Kibana repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
EOF

# 开始安装
sudo yum install kibana

# 设置开机启动
sudo systemctl daemon-reload
sudo systemctl enable kibana.service

# 开启服务
sudo systemctl start kibana.service

filebeat

最新官方下载地址:https://www.elastic.co/cn/downloads/beats/filebeat

# 插入reop文件
cat << EOF > /etc/yum.repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 8.x packages
baseurl=https://artifacts.elastic.co/packages/8.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md
EOF

# 开始安装
sudo yum install filebeat

# 设置开机启动
sudo systemctl daemon-reload
sudo systemctl enable filebeat

# 开启服务
sudo systemctl start filebeat
Tags: ELK