ELK日志分析平台-Elasticsearch搭建和异常处理

一、介绍

1.1. ELK日志分析平台

(1)不是一款软件,而是一整套解决方案,是三个软件产品的首字母缩写。

  • ELK分别代表:
    Elasticsearch:负责日志检索和储存
    Logstash:负责日志的收集和分析、处理
    Kibana:负责日志的可视化

(2)ELK组件在海量日志系统的运维中,可用于解决分布式日志数据集中式查询和管理系统监控等,故障排查,安全信息和事件管理,报表功能。

(3)部署Elasticsearch分布式集群安装,Kibana作为可视化平台,实时总结流量和数据的图表,Logstash用来收集处理日志。


二、安装Elasticsearch

Elasticsearch
https://www.elastic.co/guide/en/elasticsearch/reference/7.16/rpm.html#rpm-repo

2.1.从RPM存储库安装

  • <1>导入 Elasticsearch GPG 密钥
rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch

We sign all of our packages with the Elasticsearch Signing Key (PGP key D88E42B4, available from https://pgp.mit.edu) with fingerprint:

4609 5ACC 8548 582C 1A26 99A9 D27D 666C D88E 42B4
  • <2>vim /etc/zypp/repos.d/elasticsearch.repo
[elasticsearch]
name=Elasticsearch repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=0
autorefresh=1
type=rpm-md
  • <3>您的存储库已准备好使用。您现在可以使用以下命令之一安装 Elasticsearch:
sudo yum install --enablerepo=elasticsearch elasticsearch 
sudo dnf install --enablerepo=elasticsearch elasticsearch 
sudo zypper modifyrepo --enable elasticsearch && \
  sudo zypper install elasticsearch; \
  sudo zypper modifyrepo --disable elasticsearch 

说明:
yum在 CentOS 和旧的基于 Red Hat 的发行版上使用。
dnf在 Fedora 和其他较新的 Red Hat 发行版上使用。
zypper在基于 OpenSUSE 的发行版上使用

2.2. 从RPM存储库安装手动下载并安装RPM

Download and install the RPM manuallyedit
The RPM for Elasticsearch v7.16.3 can be downloaded from the website and installed as follows:
(自行阅读)
https://www.elastic.co/guide/en/elasticsearch/reference/7.16/rpm.html#install-rpm


三、启动

yum install -y java-1.8.0-openjdk elasticsearch
systemctl enable --now elasticsearch
[root@master ELK]# curl http://localhost:9200/
{
  "name" : "es-0001",
  "cluster_name" : "my-es",
  "cluster_uuid" : "_na_",
  "version" : {
    "number" : "7.16.3",
    "build_flavor" : "default",
    "build_type" : "rpm",
    "build_hash" : "4e6e4eab2297e949ec994e688dad46290d018022",
    "build_date" : "2022-01-06T23:43:02.825887787Z",
    "build_snapshot" : false,
    "lucene_version" : "8.10.1",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
[root@master ELK]# 

四、问题处理:

<1> Job for elasticsearch.service failed
elasticsearch启动失败问题处理

sudo nano /etc/elasticsearch/elasticsearch.yml
#修改以下几行(修改位置的模块功能说明 在文件中存在):
cluster.name: my-application
node.name: node-001
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: []

修复所有错误后,运行以下命令启动并确认Elasticsearch的状态:

sudo systemctl start elasticsearch
sudo systemctl status elasticsearch
# 说明:如果异常可以常识添加node.name的解析(/etc/hosts)
# 包括对elk系统最低运行资源标准的修改(/etc/elasticsearch/jvm.options)

其他异常问题参考链接:
https://stackoverflow.com/questions/58656747/elasticsearch-job-for-elasticsearch-service-failed

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值