没有合适的资源?快使用搜索试试~ 我知道了~
首页通过elk收集微服务模块日志.doc
1.Filebeat:filebat是一个用于转发和集中日志数据的轻量级shipper。作为代理安装在服务器上,filebeat监视指定的日志文件或位置,收集日志事件,并将它们转发给ElasticSearch或logstash进行索引。 2.Logstash:Logstash 是开源的服务器端数据处理管道,能够同时从多个来源采集数据,转换数据,然后将数据发送到存储库。 3.ElasticSearch:Elasticsearch 是基于 JSON 的分布式搜索和分析引擎,专为实现水平扩展、高可靠性和管理便捷性而设计。 4.Kibana:Kibana 能够以图表的形式呈现数据,并且具有可扩展的用户界面,供您全方位配置和管理 Elastic Stack。
资源详情
资源评论
资源推荐

通过 elk 收集微服务模块日志
前言
Elastic Stack 提供 Beats 和 Logstash 套件来采集任何来源、任何格式的数据。其实
Beats 和 Logstash 的功能差不多,都能够与 Elasticsearch 产生协同作用,而且
logstash 比 filebeat 功能更强大一点,2 个都使用是因为:Beats 是一个轻量级的采集
器,支持从边缘机器向 Logstash 和 Elasticsearch 发送数据。考虑到 Logstash 占用系
统资源较多,我们采用 Filebeat 来作为我们的日志采集器。并且这里采用 kafka 作为
传输方式是为了避免堵塞和丢失,以实现日志的实时更新。
介绍
1.Filebeat:filebat 是一个用于转发和集中日志数据的轻量级 shipper。作为代理
安装在服务器上,filebeat 监视指定的日志文件或位置,收集日志事件,并将它们
转发给 ElasticSearch 或 logstash 进行索引。
2.Logstash:Logstash 是开源的服务器端数据处理管道,能够同时从多个来源采集数
据,转换数据,然后将数据发送到存储库。
3.ElasticSearch:Elasticsearch 是基于 JSON 的分布式搜索和分析引擎,专为实现水
平扩展、高可靠性和管理便捷性而设计。
4.Kibana:Kibana 能够以图表的形式呈现数据,并且具有可扩展的用户界面,供您全
方位配置和管理 Elastic Stack。
ELK 软件版本
建议采用相同的版本 (注:可以扫描二维码进群要对应的安装包)
kafka、Zookeeper 安装
kafka 是一种高吞吐量的分布式发布订阅消息系统,它可以处理消费者规模的网站中
的所有动作流数据。
ZooKeeper 是一个分布式的,开放源码的分布式应用程序协调服务,是 Google 的
Chubby 一个开源的实现,是 Hadoop 和 Hbase 的重要组件。它是一个为分布式应用
提供一致性服务的软件,提供的功能包括:配置维护、域名服务、分布式同步、组服
务等。

Zookeeper
# 解压到 /usr/local/ 对应的目录下
tar -zxvf zookeeper-3.4.8.tar.gz -C /usr/local/
# 进入 zookeeper 目录
cd /usr/local/zookeeper-3.4.8/
# 修改配置 先复制模板配置文件,并重命名,然后里面存放数据的路径 dataDir 可以
自己定义
cp conf/zoo_sample.cfg conf/zoo.cfg
# 采用 vim | vi 编辑文件
vim conf/zoo.cfg
# 启动服务./bin/zkServer.sh start
# 查看是否启动成功./bin/zkServer.sh status
# 查看 zookeeper./bin/zkServer.sh status
ZooKeeper JMX enabled by default
Using config: /usr/local/zookeeper-3.4.8/bin/../conf/zoo.cfg
Mode: standalone
# Mode: standalone 说明启动成功

kafka
# 解压到 /usr/local/ 对应的目录下
tar -zxvf kafka_2.12-2.1.0.tgz -C /usr/local/
# 进入 kafka 目录
cd /usr/local/kafka_2.12-2.1.0/
# 修改配置文件
vim config/server.properties

# 启动 kafka./bin/kafka-server-start.sh config/server.properties
# 查看 java 进程 pid jps -l
jps -l4512 org.apache.zookeeper.server.quorum.QuorumPeerMain15684
org.logstash.Logstash10069 kafka.Kafka16317
sun.tools.jps.Jps13678 org.elasticsearch.bootstrap.Elasticsearch
# Create a topic./bin/kafka-topics.sh --create --zookeeper
localhost:2181 --replication-factor 1 --partitions 1 --topic test
# 查看 topic./bin/kafka-topics.sh --list --zookeeper
localhost:2181
# 查询 topic 详细信息./bin/kafka-topics.sh --describe --zookeeper
localhost:2181 --topic test
server.properties
# Licensed to the Apache Software Foundation (ASF) under one or
more
# contributor license agreements. See the NOTICE file
distributed with
# this work for additional information regarding copyright
ownership.
# The ASF licenses this file to You under the Apache License,
Version 2.0
# (the "License"); you may not use this file except in compliance
with

# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
software
# distributed under the License is distributed on an "AS IS"
BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied.
# See the License for the specific language governing permissions
and
# limitations under the License.
# see kafka.server.KafkaConfig for additional details and
defaults
############################# Server Basics
#############################
# The id of the broker. This must be set to a unique integer for
each broker.
broker.id=0
############################# Socket Server Settings
#############################
# The address the socket server listens on. It will get the value
returned from
# java.net.InetAddress.getCanonicalHostName() if not configured.
剩余21页未读,继续阅读















安全验证
文档复制为VIP权益,开通VIP直接复制

评论0