elastic stack中的Beats是什么?

Posted Data+Science+Insight

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了elastic stack中的Beats是什么?相关的知识,希望对你有一定的参考价值。

elastic stack中的Beats是什么?

elastic stack栈涉及到以下⼏个组件

  1. beats:⽤于轻量级⽇志采集,⽀持⽂件采集,系统数据采集,特定中间件数据采集等
  2. logstash:⽤于⽇志结构化,标签化,⽀持DSL⽅式将数据进⾏结构化
  3. elasticsearch:⽤于提供⽇志相关的索引,使得⽇志能够有效的检索
  4. kibana:⽤于提供⽇志检索,特定metric展示的⾯板,⽅便使⽤的UI
  5. x-pack:⽤于监控与预警相关的组件,可以集成到es中,kibana有特定的⾯板⽤于展示UI
  6. curator:⽤于管理ES集群的索引相关的数据,对索引进⾏分析

ELK系统有丰富的插件系统。

https://www.elastic.co/

The Elastic Stack

ELK可能是现如今最为流行,并且更新速度最快的开源大数据产品,由elastic公司维护并完全开源。

ELK分别为:

  1. Elasticsearch: 核心中的核心组件,基于著名的全文检索引擎lucence的一个分布式版本。由于扩展成分布式,容量和性能得到极大的提升,使得Elasticsearch得以成为目前许多大数据产品和大数据架构的核心组件。
  2. Logstash: 一个灵活的数据传输和处理系统,在beats出来之前,还负责进行数据收集。Logstash的任务,就是将各种各样的数据,经过配置转化规则,统一化存入Elasticsearch。使用Ruby开发的Logstash在灵活性上,确实非常出色。不过性能一直是被诟病的问题。
  3. Kibana: 展示组件,基于angularjs。从Elasticsearch中读取数据并展示。具有强大而且灵活的界面配置。

由于Logstash在数据收集上并不出色,而且作为agent,性能并不达标。elastic发布了beats系列轻量级采集组件。至此,elastic形成了一个完整的生态链和技术栈,成为大数据市场的佼佼者。本文我们重点来谈一谈beats

beats

beats是一组轻量级采集程序的统称,这些采集程序包括并不限于:

  1. filebeat: 进行文件和目录采集,主要用于收集日志数据。
  2. metricbeat: 进行指标采集,指标可以是系统的,也可以是众多中间件产品的,主要用于监控系统和软件的性能。
  3. packetbeat: 通过网络抓包、协议分析,对一些请求响应式的系统通信进行监控和数据收集,可以收集到很多常规方式无法收集到的信息。
  4. Winlogbeat: 专门针对windows的event log进行的数据采集。
  5. Heartbeat: 系统间连通性检测,比如icmp, tcp, http等系统的连通性监控。

以上是elastic官方支持的5种beats,事实上,伟大的开源力量早已创造出大大小小几十甚至上百中beats,只有你没想到的,没有beats做不到的。

为什么说beats是轻量级的呢?主要是beats在数据收集层面上并不进行过于复杂的数据处理,只是将数据简单的组织并上报给上游系统。另一方便,由于beats采用go语言开发,go是一种系统编程语言,具有并发友好以及部署方便的特点,能够在不依赖虚拟机的情况下运行,包大小通常也比较小。在跨平台上方面,beats与go语言保持一致支持linux,windows,freebsd和macos。beats的性能,明显好于大哥Logstash,一个设计良好的go语言程序基本可以达到甚至超过java程序。

beats的架构

beats之所以有如此强大的开源支持,一个很大的原因是设计良好的代码框架。

libbeat是beats的核心包,其中封装一个输出模块(Publisher),输出模块可以负责将收集到的数据发送给Logstash或者Elasticsearch。由于go语言设计有channel,收集数据的逻辑代码与Publisher都是通过channel通信的,耦合度的最低的。因此,开发一个收集器,完全不需要知道Publisher的存在,程序运行的时候自然就“神奇”的把数据发往服务端了。除此之外,还封装了配置文件处理、日志处理、守护化等功能,方便开发者拓展beats的能力。

beats的生态

beats的官方维护可以说非常活跃的,笔者跟踪beats很长时间,也做过代码贡献,对此深有体会。所以beats有一个非常健康的生态系统。

被官方收录,但官方不负责维护的beat,称为Community beats,目前有几十种,皆为开源贡献的。还有许多散落在社区的beat。

E:ElasticSearch 搜索,简称es

L:Logstash 管理日志和事件的工具

K:Kibana 功能强大的数据显示客户端

Beats 轻量级数据传输组件,这里我们主要使用FileBeat

如果logstash 压力很大,那么可以考虑filebeat 和logstash 之间引入redis或kafka作为缓冲。

。。。


X-Pack

Along with Elastic Stack, there are a few more aspects needed taken care of. These are sensitive points such as security, monitoring, alerts, and so on. X-Pack includes five such features:

  1. Security
  2. Alerts
  3. Monitoring
  4. Graphs
  5. Reporting

Security, alerts, and monitoring were already there with different names: Shield, Watcher, and Marvel, respectively. Now graphs and reporting are also part of the team, and this team is named X-Pack. Just like tools in Elastic Stack, these will also be developed, built, tested, and released together with the same version.

X-Pack

Before learning about X-Pack, let's understand how X-Pack came into existence. We have discussed the need for Elastic Stack, where earlier there were different versions maintained for Elasticsearch, Logstash, Kibana, and Beats. Therefore, to avoid confusion for the users, Elastic Team. simplified and came up with Elastic Stack where there would be a single release version for Elasticsearch, Logstash, Kibana, and Beats. After the rise in use of these products, there was a need for supporting products that would help the end user such as a need for authorization and authentication of Elasticsearch clusters and Kibana, a need for monitoring the Elasticsearch cluster using a simple yet intuitive UI, and a need for robust alerting and notification mechanisms.

X-Pack is an extension package for Elastic Stack, which combines the various product offerings apart from the components of Elastic Stack, such as Shield, Marvel, Watcher, and Graph, and provides additional features of reporting. X-Pack has the same premise as Elastic Stack, where instead of maintaining different versions of each product and always checking for the support matrix of each of the products, you no longer need to think about the various products and their version. You just need to install the X-Pack corresponding to the Elastic Stack version and you will have all the products that are properly supported, maintained, and compatible with each other. X-Pack components seamlessly work together with each other as well as independent components. X-Pack provides settings, configuration, and APIs via which you can enable or disable the component you want to use, configure the components, and access information about the components.

参考:ELK+Beats日志分析系统部署

参考:ELK和beats

参考:基于Centos7的ELK + filebeat日志分析(java weblogic平台)搭建实战

参考:Elastic Stack技术栈深入研究

参考:BlackThursdays/https-github.com-TechBookHunter-Free-Elasticsearch-Books

以上是关于elastic stack中的Beats是什么?的主要内容,如果未能解决你的问题,请参考以下文章

Beats:将 Unix 域套接字中的数据索引到 Elastic Stack

浅尝 Elastic Stack Logstash + Beats + Kafka

浅尝 Elastic Stack Logstash + Beats + Kafka

elastic stack 基础组件beats详解

浅尝 Elastic Stack Logstash + Beats 读取 Spring Boot 日志

浅尝 Elastic Stack Logstash + Beats 读取 Spring Boot 日志