实操讲解:微服务运行状态监测(二)|学习笔记

简介: 快速学习实操讲解:微服务运行状态监测(二)

开发者学堂课程【Elasticsearch 实战进阶营实操讲解:微服务运行状态监测(二)】学习笔记,与课程紧密联系,让用户快速学习知识。

课程地址:https://developer.aliyun.com/learning/course/899/detail/14321


实操讲解:微服务运行状态监测(二)


三、Elastic Stack 技术栈

1.主要概述图

image.png

早期 Elastic Stack 名为 ELK,对应 Elasticsearch,Logstash,Kibana 这三个开源软件,但由于在做日志收集时 Logstash 过于重量级,因此官方又开发了各种 Beat 组件,比如 FileBeat,PackBeat 等等。

随着这些角色的加入 ELK 更名位 Elastic Stack。

Elastic Stack 组件的主要优点有如下几个:

(1)处理方式灵活:

Elasticsearch 是实时全文索引,具有强大的搜索功能。

(2)配置相对简单:

Elasticsearch 全部使用 JSON 接口,Logstash 使用模块配置,Kibana 的配置文件部分更简单。

(3)检索性能高效:

基于优秀的设计,虽然每次查询都是实时,但是也可以达到百万级数据的查询查询秒级响应。

(4)集群线性扩展:

Elasticsearch 和 Logstash 都可以灵活线性扩展。

(5)前端操作绚丽:

Kibana 的前端设计比较绚丽,而且操作简单。

为什么要用 Elastic Stack 组件?

Elastic Stack 组件在海量日志系统运维中,可以用于解决以下主要问题:

(1)分布式日志数据统一收集,实现集中式查询和管理;

(2)故障排除;

(3)安全信息和事件管理;

(4)报表功能;

Elastic Stack  在大数据运维系统中,主要可解决的问题如下:

(1)日志查询,问题排查,故障恢复,故障自愈;

(2)应用日志分析,错误报警;

(3)性能分析,用户行为分析;

 

四、Elastic+kibana 自有环境

1、动手配置自己的 ES 运行环境

(1)准备好环境

## ############并并Heartbeat Configuration Example #并# ## ##并####### # ## ##并##并井

is file is an example configuration

file highlighting only some common options。

# The heartbeat. reference .yml file in the same directory contains all the supported options

# with detailed com

ments. You can use it for reference。

#

# You can find the full configuration reference here ;

# https://www. elastic。co/ guide/ en/ beats/ heartbeat/ index。html

######## ###井林## ### ###井#井####井Heartbeat ###井 ### ##井并井

### ## # ####并##井井林##井#并##井并井

# Define a directory to load monitor definitions from. Definitions take the form

# of individual yaml files. .

heartbeat . confi

配置节点

be loaded.

type: http # monitor type http 。Connect via HTTP an optionally verify response

# Monitor name used for job name and document type

name: eureka

t Enable/Disable monitor

enabled: true

# Configure task schedule

schedule: ' @every 5s' # every 5 seconds from start of beat

# Configure URLS to ping

hosts: ["http: //1ocalhost:8020"]

# Configure IP protocol types to ping on if hostnames are confi gured。

# Ping all resolvable IPs if" mode is" all^ ,or only one IP if mode is" any.

ipv4: true

ipv6: true

I

mode: any

# Optional HTTP proxy url.

#proxy_ url: '

# Total test connection and data exchange t imeout

#timeout: 16s

# Optional Authentication Credentials

#uS ername :

g。monitors :

I

# Directory + glob pattern to search for configuration files

path: ${path . config}/ monitors .d/* . yml

# If enabled, heartbeat will periodically check the config . monitors path for c

hanges

reload. enabled: true

# How often to check for changes

reload.period: 5s

# Configure monitors inline

# heartbeat 。monitors ;

# - type: http

# List or urls to

query

# urls: ["http://localhost:9200" ]

# Configure task schedule

# schedule:" @every 10s

输出地要到 es 里面

2nd2no yse2s807 -

“unKTe@ypJeasoTaseT3. :pJomssed

DTiSeTan

:aweuuasn

wKey Tde:pTm :Kax τde#

”pJomssed/a

weuJasn JO Kay IdV JB42τa 一sTeTauapaJs uoTaesT2ua4any #

sd224u : To5020Jd#

、 sd224. JO (T

安全地址

nefep) d224、Ja47ta - TODO10Jd #

[.00Z6 :wO2. sounAtte "ypJeasotaseta'ottand. ZUMnTOOOUUMJATMa0-U2-sa.] :s2soy

02 23auUOS of S2Soy 4o KeJuy #

:ypJeasoTa

seTa "2nd2no

andzno ypueasoTset3 ---

# You can find the full configuration reference here :

# https:/ /www. elastic。co/ guide/ en/ beats/ heartbeat/ index. html

##########################并并并Heartbeat ###并 ###井#井# # ## ## #井# # # # ## ## ### # # #并# ####

# Define a directory to load monitor definitions from. Definitions take the form

# of individual yaml files。

heartbeat。config。monitors :

# Directory + glob pattern to search for configuration files

path: ${path. config}/monitors . dA . yml

# If enabled, heartbeat will periodically check the config 。monitors path for changes

reload .enabled: true

# How often to check for changes

reload. period: 5s

# Configure monitors inline

# heartbeat 。monitors ;

# - type: http

# List or urls to query

# urls: ["http://localhost:9200"]

# Configure task schedule

# schedule:" @every 10s

# Total test connection and data exchange t imeout

#timeout: 16s

# These files contain a list of monitor confi gurations identical

# to the heartbe

at。monitors section in heartbeat。yml

# The 。example extension on this file must be removed for it to

# be loaded 。

type: http # monitor type http^ 。Connect via HTTP an optionally verify res ponse

# Monitor nam

e used for job name and document type

name: eureka

# Enable/Disable monitor

enabled: true

# Configure task schedule

schedule:' @every 5s' # every 5 seconds from start of beat

# Configure URLS to ping

hosts:| [ "http://localhost:8020"]

并Configure IP protocol types to ping on if hostnames are

configured .

# Ping all

resolvable IPs if mode i S

all,or only one IP if" mode is" any.

ipv4: true

ipv6: true

mode: any

# Optional HTTP proxy url.

#proxy_ url:

并Total test connection and data exchange t imeout

#timeout: 16s

主要配置顶

# cluster 集群配置

cluster.name: dmall_ test_ es #名字自己起,确保集群名不同

cluster. initial_ master_ nodes: ["ip:port"] #初始主节点的ip和端口,填你本机ip,默认端口是9300

network.host: ip #填你本机ip

http.port: 9200

#绑定到传入HTTP请求的端口默认是9200

transport. tcp.port: 9300 #端口绑定节点之间的通信默认是9300

#该配置十分重要,没有正确配置,可能无法构成集群

#这是一个集群中的主节点的初始列表,当节点(主节点或者数据节点)启动时使用这个列表进行探测

discovery. zen. ping. unicast.hosts: ["ip:port"] #端口一般填 TCP 端口,如9300

#以下两个配置,可能不配置也可以

xpack. security . enabled: false #没置为 true 则在节点上启用 X-Pack 安全特性,false 表 示禁用 X-Pack 安全:

xpack. security. transport. ssl.enabled: false #xpack ssl 配置,设置成 false 就可以。

出现以下结果,代表运行启动正常

"name" : "6LUo_ Ih",

"cluster_ name" :

"elasticsearch",

"cluster_ uuid" : "tnCuoQs9RQOTkDevKI4y6Q" ,

"version”: {

"number" : "7.5.1".

"build_ flavor" : "default",

"build_ type”: "tar",

"build_ hash" : "1fad4e1",

"build_ date”: "2019-06-18T13:16:52.517138Z",

"build_ snapshot" : false,

"lucene_ version" : "7.7.0",

"minimum_ wire_ compatibility_ version" : "5.6.0",

"minimum_ index_ compatibility_ version" : "5.0.0"

},

"tagline" : "You Know, for Search"

启动 kibana

2nd2no yse2s807 -

“unKTe@ypJeasoTaseT3. :pJomssed

DTiSeTan

:aweuuasn

wKey Tde:pTm :Kax τde#

”pJomssed/a

weuJasn JO Kay IdV JB42τa 一sTeTauapaJs uoTaesT2ua4any #

sd224u : To5020Jd#

、 sd224. JO (T

安全地址

nefep) d224、Ja47ta - TODO10Jd #

[.00Z6 :wO2. sounAtte "ypJeasotaseta'ottand. ZUMnTOOOUUMJATMa0-U2-sa.] :s2soy

02 23auUOS of S2Soy 4o KeJuy #

:ypJeasoTa

seTa "2nd2no

andzno ypueasoTset3 ---

# You can find the full configuration reference here :

# https:/ /www. elastic。co/ guide/ en/ beats/ heartbeat/ index. html

path: ${path. config}/monitors . dA . yml

# If enabled, heartbeat will periodically check the config 。monitors path for changes

reload .enabled: true

# How often to check for changes

reload. period: 5s

# Configure monitors inline

# heartbeat 。monitors ;

# - type: http

# List or urls to query

# urls: ["http://localhost:9200"]

# Configure task schedule

# schedule:" @every 10s

# Total test connection and data exchange t imeout


相关实践学习
以电商场景为例搭建AI语义搜索应用
本实验旨在通过阿里云Elasticsearch结合阿里云搜索开发工作台AI模型服务,构建一个高效、精准的语义搜索系统,模拟电商场景,深入理解AI搜索技术原理并掌握其实现过程。
ElasticSearch 最新快速入门教程
本课程由千锋教育提供。全文搜索的需求非常大。而开源的解决办法Elasricsearch(Elastic)就是一个非常好的工具。目前是全文搜索引擎的首选。本系列教程由浅入深讲解了在CentOS7系统下如何搭建ElasticSearch,如何使用Kibana实现各种方式的搜索并详细分析了搜索的原理,最后讲解了在Java应用中如何集成ElasticSearch并实现搜索。  
相关文章
|
存储 Java 时序数据库
【SpringBoot系列】微服务监测(常用指标及自定义指标)
【4月更文挑战第6天】SpringBoot微服务的监测指标及自定义指标讲解
935 0
|
JavaScript 前端开发 Java
垃圾分类管理系统基于 Spring Boot Vue 3 微服务架构实操指南
本文介绍了基于Java技术的垃圾分类管理系统开发方案与实施案例。系统采用前后端分离架构,后端使用Spring Boot框架搭配MySQL数据库,前端可选择Vue.js或Java Swing实现。核心功能模块包括垃圾分类查询、科普教育、回收预约等。文中提供了两个典型应用案例:彭湖花园小区使用的Swing桌面系统和基于Spring Boot+Vue的城市管理系统,分别满足不同场景需求。最新技术方案升级为微服务架构,整合Spring Cloud、Redis、Elasticsearch等技术,并采用Docker容器
695 1
|
12月前
|
IDE Java API
Java 17 新特性与微服务开发的实操指南
本内容涵盖Java 11至Java 17最新特性实战,包括var关键字、字符串增强、模块化系统、Stream API、异步编程、密封类等,并提供图书管理系统实战项目,帮助开发者掌握现代Java开发技巧与工具。
729 0
|
开发框架 IDE .NET
【Azure 微服务】Service Fabric中微服务在升级时,遇见Warning - System.Collections.Generic.KeyNotFoundException 服务无法正常运行
【Azure 微服务】Service Fabric中微服务在升级时,遇见Warning - System.Collections.Generic.KeyNotFoundException 服务无法正常运行
345 0
【Azure 微服务】Service Fabric中微服务在升级时,遇见Warning - System.Collections.Generic.KeyNotFoundException 服务无法正常运行
|
Java API 微服务
Java 21 与 Spring Boot 3.2 微服务开发从入门到精通实操指南
《Java 21与Spring Boot 3.2微服务开发实践》摘要: 本文基于Java 21和Spring Boot 3.2最新特性,通过完整代码示例展示了微服务开发全流程。主要内容包括:1) 使用Spring Initializr初始化项目,集成Web、JPA、H2等组件;2) 配置虚拟线程支持高并发;3) 采用记录类优化DTO设计;4) 实现JPA Repository与Stream API数据访问;5) 服务层整合虚拟线程异步处理和结构化并发;6) 构建RESTful API并使用Springdoc生成文档。文中特别演示了虚拟线程配置(@Async)和StructuredTaskSco
1262 0
|
Cloud Native Java Devops
Java 学习路线之环境搭建微服务项目实战及 DevOps 流程实操内容解析
这是一份结合最新技术的Java学习路线,涵盖环境搭建、微服务项目实战及DevOps流程。内容包括2025年版开发环境配置(如SDKMAN管理JDK、)、Gradle构建工具使用、微服务图书管理系统实战(Spring Boot 3.3 + Spring Cloud 2025.0)、云原生部署)、AI融合实践(OpenAI集成)以及性能优化与监控(JFR/Micrometer/Sleuth)。通过每日实践、代码审查和技术分享,帮助你掌握现代企业级开发技能,实现云原生应用的独立开发与部署。资源地址:[点击下载](https://pan.quark.cn/s/14fcf913bae6)。
743 0
|
SpringCloudAlibaba Java 网络架构
【Springcloud Alibaba微服务分布式架构 | Spring Cloud】之学习笔记(七)Spring Cloud Gateway服务网关
【Springcloud Alibaba微服务分布式架构 | Spring Cloud】之学习笔记(七)Spring Cloud Gateway服务网关
2069 0
|
消息中间件 API 数据库
在微服务架构中,每个服务通常都是一个独立运行、独立部署、独立扩展的组件,它们之间通过轻量级的通信机制(如HTTP/RESTful API、gRPC等)进行通信。
在微服务架构中,每个服务通常都是一个独立运行、独立部署、独立扩展的组件,它们之间通过轻量级的通信机制(如HTTP/RESTful API、gRPC等)进行通信。
|
SpringCloudAlibaba 负载均衡 Java
【Springcloud Alibaba微服务分布式架构 | Spring Cloud】之学习笔记(目录大纲)
【Springcloud Alibaba微服务分布式架构 | Spring Cloud】之学习笔记(目录大纲)
1050 1
|
运维 监控 Java
微服务心跳监测机制讲解与实现,与面试过程中如何回答这个问题
微服务心跳监测机制讲解与实现,与面试过程中如何回答这个问题
508 0