当前位置: 首页 > news >正文

ES 集群常用排查命令

说明:集群使用非默认端口9200,使用的是7116端口举例

一、常用命令

#1.集群健康状态


[wlsadmin@elastic-01~]$ curl -XGET "http://10.219.27.00:7116/_cluster/health?pretty"
{
cluster name":"cluster"
"status": "yellow",   #集群状态
"timed out" : false,
"number of nodes": 3,  #集群的节点数
"number_of data nodes": 3, #数据节点数
"active_primary_shards" : 8036,  #集群中所有活跃的主分片数
"active shards": 16082, #集群中所有活跃的分片数
"relocating shards": 0, #当前节点迁往其他节点的分片数量,通常为0,当有节点加入或者退出时该值会增加。
"initializing shards": 0, #正在初始化的分片
"unassigned shards": 10,  #未分配的分片数,通常为0,当有某个节点的副本分片丢失该值就会增加。
"delayed unassigned shards": 0,
"number of pending tasks": 0, 是指主节点创建索引并分配shards等任务,如果该指标数值一直未减小代表集群存在不稳定因素
"number of in flight fetch" :0,
"task max waiting in queue millis": 0,
"active shards percent as number" :99.93785732040766  #集群分片健康度,活跃分片数占总分片数比例。
}说明:pending task只能由主节点来进行处理,这些任务包括创建索引并将shards分配给节点。
#2.集群状态信息
[wlsadmin@elastic-01~]$ curl -XGET "http://10.219.27.00:7116/_cluster/stats?pretty"
{"_nodes":{"total":3,"successful":3,"failed":0},"cluster name":"cluster""timestamp": 1650958054278,"status": "yellow","indices":{"count”:1612,  #索引总数"shards":{"total”:16082,  #分片总数"primaries”:8036, #主分片数量"replication”: 1.001244400199104"index":{"shards":{"min": 2,"max”:15,"avg”: 9.97642679900744},"docs”:{"count”: 6917866009,  #文档总数"deleted": 16940},"store":{"size in bytes”:7722541162072  #数据总存储容量"throttle time in millis": 0},"fielddata”:{"memory_size_in_bytes": 2400,"evictions”:0},"segments”:{"count”:182641, #段总数"memory in bytes”: 22809369464,"terms memory in bytes": 20058152621"stored fields memory in bytes”:2091992312"term vectors memory in bytes”: 0,"norms memory in bytes":197683328,"points memory in bytes”: 170072327,"doc values memory in bytes”: 291468876,"index writer memory in bytes”:87483620"version map memory in bytes":346399,"fixed_bit_set memory_in_bytes”: 5536,"max unsafe auto id timestamp”:1650945037930"file_sizes”:{}}},"nodes":{"count”:{"total”:3,  #总节点数"data”:3,  #数据节点数"coordinating_only”: 0,"master”: 3,"ingest”:3},"versions”:["5.6.16"], "fs":{"total in bytes”: 11249073020928,  #文件系统使用总容量"free in bytes”: 2432532422656,  #文件系统剩余总容量"available in bytes”: 1942384254976,"spins":"true"}...

#3.查看索引信息

[wlsadmin@elastic-01~]$ curl -XGET "http://10.219.27.00:7116/_cat/indices"
green open .kibana-event-log-7.8.0-000001 93qZ6-tUT1GJa9w-beZtqQ 1 1      5 0  51.5kb  25.7kb
green open .kibana-event-log-7.8.0-000002 aVeWX45vRqK5bi5ANvz3EA 1 1      0 0    416b    208b
green open .apm-custom-link               qMdSK3MAQxa4Ip37SPkaaw 1 1      0 0    416b    208b#4.查看节点信息
[wlsadmin@elastic-01~]$ curl -XGET "http://10.219.27.00:7116/_cat/nodes?pretty"
XX.XX.XX.XX 16 64 0 0.06 0.04 0.05 dilmrt * node-1   #主节点
XX.XX.XX.XX 11 64 0 0.00 0.01 0.05 dilmrt - node-2
XX.XX.XX.XX  9 67 0 0.00 0.01 0.05 dilmrt - node-3
#5.查看索引级别,找到红色的索引

[root@ES-node1]# curl -X GET /_cluster/health?level=shards
"apache-logs8xxxx”:{
"status" : "green",
"number_of_shards": 1,
"nusber_of_replicas":1.
"active_primary_shards":1,
"active_shards":2,
"relocating_shards”:0,
"initializing.shards”: 0
"unassignedshards”:0},
"mytest”:{
"status" : "red",   #状态为红色的索引
"number_of_shards" :3.
"number_of_replicas":0.
"active_primary_shards": 0,
"active_shards" : 0,
"relocating shards": 0.
"initializing shards": 0.
"unassigned_shards”:3},#6.查看变红原因(explanation变红原因)
GET /_cluster/allocation/explain
"node_decision" : "no",
"weight_ranking":3,"deciders”:[
{"decider":"filter","decision":"NO","explanation”:"""node does not match index setting Lindex.routing.allocation.require] filters [box type: "hott"]""

二、案例分析

2.1集群变红

症状:集群变红
分析:通过Allocation Explain API 发现创建索引失败,因为无法找到标记了相应box type的节点
解决:删除索引,集群变绿,重新创建索引,并且指定正确的routing box type,索引创建成功集群保持绿色状态

1.查看索引级别,找到红色的索引
GET /_cluster/health?level=shards
"apache-logs8xxxx”:{
"status" : "green",
"number_of_shards": 1,
"nusber_of_replicas":1.
"active_primary_shards":1,
"active_shards":2,
"relocating_shards”:0,
"initializing.shards”: 0
"unassignedshards”:0},
"mytest”:{
"status" : "red",   #状态为红色的索引
"number_of_shards" :3.
"number_of_replicas":0.
"active_primary_shards": 0,
"active_shards" : 0,
"relocating shards": 0.
"initializing shards": 0.
"unassigned_shards”:3},2.查看变红原因(explanation变红原因)
GET /_cluster/allocation/explain
"node_decision" : "no",
"weight_ranking":3,"deciders”:[
{"decider":"filter","decision":"NO",   #因为box-type不符合规则,删除不正确的索引重新创建"explanation”:"""node does not match index setting Lindex.routing.allocation.require] filters [box type: "hott"]""3.删除错误的索引
curl -XDELETE localhost:9200/index_name #索引名字
DELETE  mytest4.重新创建新索引
PUT mytest
{
"settings":{
"number_of_shards":3,
"number_of_replicas":0
"index.routing.allocation.require.box_type":"hot"}

2.2集群变黄

症状:集群变黄
分析:通过Allocation Explain API 发现无法在相同的节点上创建副本(副本分片无法正常分配)
解决:将索引的副本数设置为0,或者通过增加节点解决

1.创建索引使集群变黄
PUT mytest
{"settings":{"nameber_of_shards":2, #分片2"namber_of_replicas":1, #副本1"index.routing.allocation.requice.box_type":'hot' #指定hot节点创建}
}2.查看集群健康状态为黄色
GET _cluster/health3.查看集群黄色原因(因为集群只有一个hot节点,不能再相同的节点上创建副本)
GET /_cluster/allocation/explain
"explanation": "the shard cannot be allocated to the same node on which a copy of the shard already exists[[mytest][1],node[1-wAVO-FT0GLAdRk8-N-GQ],[P], s[STARTED],a[id=_PLt4SS1SyGvxncvU3HN-w]]"4.解决方法
方法1:增加数据节点,使得有副本分配空间;
方法2:修改索引的setting使replicos为0
PUT mytest/_settings
{"namber_of_replicas":0
}
创建后集群恢复绿色状态

2.3集群磁盘空间达到阈值

问题:es节点磁盘占用较高,达到阈值,集群状态成red
此时直接删除索引磁盘空间是不会释放的,可以通过调整阈值,将集群状态变为yellow

通过api动态修改:transient 临时更改,persistent是永久更改临时修改:重启es后失效curl -H "Content-Type: application/json" -XPUT 10.203.118.32:9200/_cluster/settings -d '{"transient": { "cluster.routing.allocation.disk.watermark.low": "92%", "cluster.routing.allocation.disk.watermark.high": "95%", "cluster.info.update.interval": "1m"}}'永久修改:curl -H "Content-Type: application/json" -XPUT 10.203.118.32:9200/_cluster/settings -d '{"persistent": { "cluster.routing.allocation.disk.watermark.low": "90%", "cluster.routing.allocation.disk.watermark.high": "95%", "cluster.info.update.interval": "1m" } }’在删除索引可达到空间释放的作用
修改es配置文件,需要重启es

2.3.2 更改es配置文件,需要重启es

cluster.routing.allocation.disk.watermark.lowControls the low watermark for disk usage. It defaults to 85%, meaning that Elasticsearch will not allocate shards to nodes that have more than 85% disk used. It can also be set to an absolute byte value (like 500mb) to prevent Elasticsearch from allocating shards if less than the specified amount of space is available. This setting has no effect on the primary shards of newly-created indices or, specifically, any shards that have never previously been allocated.cluster.routing.allocation.disk.watermark.highControls the high watermark. It defaults to 90%, meaning that Elasticsearch will attempt to relocate shards away from a node whose disk usage is above 90%. It can also be set to an absolute byte value (similarly to the low watermark) to relocate shards away from a node if it has less than the specified amount of free space. This setting affects the allocation of all shards, whether previously allocated or not.cluster.routing.allocation.disk.watermark.flood_stageControls the flood stage watermark. It defaults to 95%, meaning that Elasticsearch enforces a read-only index block (index.blocks.read_only_allow_delete) on every index that has one or more shards allocated on the node that has at least one disk exceeding the flood stage. This is a last resort to prevent nodes from running out of disk space. The index block must be released manually once there is enough disk space available to allow indexing operations to continue.es 集群的默认配置是当集群中的某个节点磁盘达到使用率为 85% 的时候,就不会在该节点进行创建副本,当磁盘使用率达到 90% 的时候,尝试将该节点的副本重分配到其他节点。当磁盘使用率达到95% 的时候,当前节点的所有索引将被设置为只读索引。

相关文章:

ES 集群常用排查命令

说明:集群使用非默认端口9200,使用的是7116端口举例 一、常用命令 #1.集群健康状态 [wlsadminelastic-01~]$ curl -XGET "http://10.219.27.00:7116/_cluster/health?pretty" { cluster name":"cluster" "status"…...

Nougat 深度剖析

Nougat 深度剖析 项目地址:https://github.com/facebookresearch/nougat 论文地址:Nougat: Neural Optical Understanding for Academic Documents 0 背景 近日,MetaAI又放了大招,他们提出了一种全新的端到端的OCR模型&#x…...

ffmpeg的使用

本文章记录ffmpeg 源码下载,编译,及使用。 一、FFMPEG 源码下载解压 源码官网地址:http://ffmpeg.org/download.html#releases 下载最新版本ffmpeg6.0。 使用命令tar xvJf ffmpeg-6.0.tar.xz 解压。 二、了解FFMPEG源码 (一&am…...

深度强化学习算法的参数更新时机

深度强化学习算法的参数更新时机 深度强化学习中往往涉及到多个神经网络来拟合策略函数、值函数等,什么时候更新参数因算法而异,与具体算法架构/算法思想紧密相关。 算法参数更新时机架构DQN先收集一定经验,然后每步更新Off Policy Value-B…...

【进阶篇】MySQL的MVCC实现机制详解

文章目录 0.前言1.基础介绍1.1. 什么是MVCC?1.1. 什么是当前读和快照读?1.1. 当前读,快照读和MVCC的关系1.1. MVCC能解决什么问题,好处是?1.1.1. 提高并发性能1.1.2. 避免死锁1.1.3. 解决脏读、不可重复读和幻读等问题1.1.4. 实现…...

Git 命令行查看仓库信息

目录 查看系统config ​编辑查看当前用户(global)配置 查看当前仓库配置信息 查看系统config git config --system --list 1 查看当前用户(global)配置 git config --global --list 1 查到的是email , name 等ssl签名信息&a…...

【爬虫】8.1. 深度使用tesseract-OCR技术识别图形验证码

深度使用tesseract-OCR技术识别图形验证码 文章目录 深度使用tesseract-OCR技术识别图形验证码1. OCR技术2. 准备工作3. 简单作用了解3.1. 验证码图片爬取-screenshot_as_png3.2. 识别测试-image_to_string3.2.1. 正确识别3.2.2. 错误识别3.2.3. 灰度调节 3.3. 识别实战-使用im…...

【PythonRS】基于GDAL修改栅格数据的DN值

遥感工作者离不开栅格数据,有时候我们可能需要修改栅格数据的值,但ENVI和ArcGIS中并没有直接修改DN值的工具,只有栅格计算器、Band math这些工具去计算整个波段的值,或者Edit Classification Image工具可以修改ENVI分类后的像元值…...

mysql课堂笔记 mac

目录 启动mac上的mysql 进入mysql mac windows 创建数据库 创建表 修改字段数据类型 修改字段名 增加字段 删除字段 启动mac上的mysql sudo /usr/local/mysql/support-files/mysql.server start 直接输入你的开机密码即可。 编辑 进入mysql mac sudo /usr/local…...

2023年数学建模国赛A 定日镜场的优化设计思路分析

构建以新能源为主体的新型电力系统,是我国实现“碳达峰”“碳中和”目标的一项重要措施。塔式太阳能光热发电是一种低碳环保的新型清洁能源技术[1]。定日镜是塔式太阳能光热发电站(以下简称塔式电站)收集太阳能的基本组件,其底座由…...

【QT】QMessageBox消息框的使用(16)

在实际项目中,弹出消息框是一个很常见的操作,包含错误信息提示、警告信息提示、关于信息提示、还包括判断信息选择等操作,那么今天通过这一节来好好了解下消息框的使用方法。 一.环境配置 1.python 3.7.8 可直接进入官网下载安装&#xf…...

XL-LightHouse 与 Flink 和 ClickHouse 流式大数据统计系统

一个Flink任务只能并行处理一个或少数几个数据流,而XL-LightHouse一个任务可以并行处理数万个、几十万个数据流; 一个Flink任务只能实现一个或少数几个数据指标,而XL-LightHouse单个任务就能支撑大批量、数以万计的数据指标。 1、XL-LightHo…...

【postgresql 基础入门】创建数据库的方法,存储位置,决定自己的数据的访问用户和范围

创建数据库 ​专栏内容: postgresql内核源码分析手写数据库toadb并发编程 ​开源贡献: toadb开源库 个人主页:我的主页 管理社区:开源数据库 座右铭:天行健,君子以自强不息;地势坤,君…...

科技云报道:AI时代,对构建云安全提出了哪些新要求?

科技云报道原创。 随着企业上云的提速,一系列云安全问题也逐渐暴露出来,云安全问题得到重视,市场不断扩大。 Gartner 发布“2022 年中国 ICT 技术成熟度曲线”显示,云安全已处于技术萌芽期高点,预期在2-5年内有望达到…...

如何让 Llama2、通义千问开源大语言模型快速跑在函数计算上?

:::info 本文是“在Serverless平台上构建AIGC应用”系列文章的第一篇文章。 ::: 前言 随着ChatGPT 以及 Stable Diffusion,Midjourney 这些新生代 AIGC 应用的兴起,围绕AIGC应用的相关开发变得越来越广泛,有呈井喷之势,从长远看这波应用的爆…...

Linux内核源码分析 (B.2)虚拟地址空间布局架构

Linux内核源码分析 (B.2)虚拟地址空间布局架构 文章目录 Linux内核源码分析 (B.2)虚拟地址空间布局架构一、Linux内核整体架构及子系统二、Linux内核内存管理架构 一、Linux内核整体架构及子系统 Linux内核只是操作系统当中的一部分,对下管理系统所有硬件设备&…...

Spring系列文章:Spring使用JdbcTemplate

一、简介 JdbcTemplate是Spring提供的⼀个JDBC模板类&#xff0c;是对JDBC的封装&#xff0c;简化JDBC代码。 当然&#xff0c;你也可以不⽤&#xff0c;可以让Spring集成其它的ORM框架&#xff0c;例如&#xff1a;MyBatis、Hibernate等。 第一步&#xff1a;引入依赖 <d…...

[matlab]cvx安装后测试代码

测试环境&#xff1a; windows10 x64 matlab2023a 代码来自官方网站&#xff1a;CVX: Matlab Software for Disciplined Convex Programming | CVX Research, Inc. m 20; n 10; p 4; A randn(m,n); b randn(m,1); C randn(p,n); d randn(p,1); e rand; cvx_beginva…...

【css】margin:auot什么情况下失效

margin&#xff1a;auto只对块级元素有效果&#xff0c;并且在正常文档流margin&#xff1a;automargin&#xff1a;0 auto&#xff0c;css默认在正常文档流里面margin-top和margin-bottom是0 为什么margin: auto能实现水平居中&#xff0c;而垂直居中不行&#xff1f; 一般子…...

linux的dirty page回写磁盘过程中是否允许并发写入更新page?

概述 众所周知Linux内核write系统调用采用pagecache机制加速写入过程,避免write系统调用长时间block应用进程,用户态进程执行write调用的时候,内核只是将用户态buffer copy到内核的pagecache当中,write系统调用就返回了,完全不需要等待数据完全写入存储设备,因为存储设备…...

WebSocket代理避坑指南:Nginx中proxy_set_header的3个关键配置项

WebSocket代理实战&#xff1a;Nginx中proxy_set_header的3个黄金法则 当在线聊天室的用户突然集体掉线&#xff0c;或是实时协作文档频繁失去同步时&#xff0c;问题往往藏在那些容易被忽视的HTTP头信息里。WebSocket作为现代实时应用的血管&#xff0c;其代理配置的精细程度直…...

开源解决方案:企业零代码条码生成的降本实践指南

开源解决方案&#xff1a;企业零代码条码生成的降本实践指南 【免费下载链接】librebarcode Libre Barcode: barcode fonts for various barcode standards. 项目地址: https://gitcode.com/gh_mirrors/li/librebarcode 一、条码管理的隐性成本陷阱&#xff1a;中小企业…...

3大突破:重新定义Revit插件开发流程

3大突破&#xff1a;重新定义Revit插件开发流程 【免费下载链接】RevitAddInManager Revit AddinManager update .NET assemblies without restart Revit for developer. 项目地址: https://gitcode.com/gh_mirrors/re/RevitAddInManager 引言&#xff1a;Revit插件开发…...

RevokeMsgPatcher 2.1 终极指南:Windows平台微信QQ消息防撤回实战解决方案

RevokeMsgPatcher 2.1 终极指南&#xff1a;Windows平台微信QQ消息防撤回实战解决方案 【免费下载链接】RevokeMsgPatcher :trollface: A hex editor for WeChat/QQ/TIM - PC版微信/QQ/TIM防撤回补丁&#xff08;我已经看到了&#xff0c;撤回也没用了&#xff09; 项目地址:…...

用了Qoder写代码飞快,联调时却总因字段不一致返工,问题出在哪?

发版前夜&#xff0c;前端字段对不上后端接口&#xff0c;联调卡了整晚。这种场景在 AI Coding 普及后并不罕见&#xff0c;不少团队用了 Qoder 觉得生成快、跑通快&#xff0c;可一旦要改需求&#xff0c;系统就僵住了。看似工具背锅&#xff0c;其实根子往往不在速度&#xf…...

从YOLOv5到YOLOv8:停车位检测模型演进与实战性能对比

1. YOLO系列模型的技术演进路径 YOLO&#xff08;You Only Look Once&#xff09;系列模型作为目标检测领域的标杆算法&#xff0c;从2015年诞生至今已经经历了多次重大迭代。每次版本更新都带来了显著的性能提升和架构创新&#xff0c;这使得YOLO系列在实时目标检测任务中始终…...

终极指南:OpCore Simplify如何让你零基础打造完美黑苹果系统

终极指南&#xff1a;OpCore Simplify如何让你零基础打造完美黑苹果系统 【免费下载链接】OpCore-Simplify A tool designed to simplify the creation of OpenCore EFI 项目地址: https://gitcode.com/GitHub_Trending/op/OpCore-Simplify 还在为复杂的OpenCore EFI配置…...

LangChainJS审计日志:AI操作可追溯性的完整指南

LangChainJS审计日志&#xff1a;AI操作可追溯性的完整指南 【免费下载链接】langchainjs 项目地址: https://gitcode.com/GitHub_Trending/la/langchainjs 在当今AI应用开发中&#xff0c;确保AI操作的可追溯性和透明性至关重要。LangChainJS提供了强大的审计日志系统…...

QGIS3.28最新版行政区合并避坑指南:县转市数据融合的3个关键检查点

QGIS 3.28行政区合并实战&#xff1a;县转市数据融合的3个关键检查点 当我们需要将县级行政区数据合并为市级边界时&#xff0c;看似简单的"线转面融合"操作背后&#xff0c;往往隐藏着诸多数据陷阱。许多中级用户在QGIS中执行这类操作时&#xff0c;明明步骤正确却频…...

实战指南:基于快马平台快速开发树莓派远程视频监控系统

最近在折腾树莓派&#xff0c;想做个简单的远程监控系统。之前总卡在环境配置和代码调试上&#xff0c;后来发现用InsCode(快马)平台可以快速生成可运行的项目骨架&#xff0c;省去了不少麻烦。这里分享下我的实现过程&#xff1a; 硬件准备 树莓派4B搭配官方摄像头模块是最基础…...