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

es运维常用命令

GET _search
{
“query”: {
“match_all”: {}
}
}

GET _cat/shards?v&s=state,index

1. 查看所有未分配的分片,确认 .watches 的状态

GET _cat/shards?v&s=state,index

2. 让 ES 解释为什么这个分片无法分配 (这是最关键的命令!)

GET _cluster/allocation/explain
{
“index”: “.watches”,
“shard”: 0,
“primary”: true
}

3. 检查集群健康状态和节点磁盘空间

GET _cluster/health
GET _cat/allocation?v
GET _cat/nodes?v&h=name,disk.total,disk.used,disk.avail,disk.used_percent

POST _cluster/reroute?retry_failed
{
“commands”: [
{
“allocate_empty_primary”: {
“index”: “.watches”, // 要修复的索引名
“shard”: 0, // 分片号,从 explain 输出中可知是 0
“node”: “3doFd3bZRyi1p8bcQ-CLmw”, // 选择任意一个节点的ID,例如第一个
“accept_data_loss”: true // 必须设置为 true,确认我们接受数据丢失
}
}
]
}

POST _cluster/reroute?retry_failed
{
“commands”: [
{
“allocate_empty_primary”: {
“index”: “.watches”,
“shard”: 0,
“node”: “3doFd3bZRyi1p8bcQ-CLmw”,
“accept_data_loss”: true
}
}
]
}

查看当前正在进行的分片恢复和迁移活动

GET _cat/recovery?active_only=true&detailed=true

实时查看集群中所有分片的状态(关注 RELOCATING 和 INITIALIZING 状态)

GET _cat/shards?v&h=index,shard,prirep,state,node,unassigned.reason&s=state

对正在迁移的分片使用此API。你需要知道分片的index, shard号, 和是primary还是replica。

GET _cluster/allocation/explain
{
“index”: “eds_forly_info_202506”,
“shard”: 0,
“primary”: true
}

GET _cluster/settings
{

}

GET _cluster/allocation/explain?pretty

GET _cluster/state/master_node,routing_table,blocks

POST /eds_forly_info_202411/_forcemerge?only_expunge_deletes=true
POST /eds_forly_info_202405/_forcemerge?only_expunge_deletes=true
POST /eds_forly_info_202406/_forcemerge?only_expunge_deletes=true
POST /eds_forly_info_202407/_forcemerge?only_expunge_deletes=true

GET eds_forly_info_202409/_search
POST /eds_forly_info_202501/_forcemerge?max_num_segments=1
POST /eds_forly_info_202501,eds_forly_info_202502,eds_forly_info_202503/_forcemerge?max_num_segments=1

POST /eds_forly_info_202505,eds_forly_info_202505,eds_forly_info_202506/_forcemerge?max_num_segments=1

POST /eds_forly_info_202507,eds_forly_info_202508,eds_forly_info_202509/_forcemerge?max_num_segments=1

http://www.xdnf.cn/news/1461403.html

相关文章:

  • 基于cornerstone3D的dicom影像浏览器 第四章 鼠标实现翻页、放大、移动、窗宽窗位调节
  • 进阶向:Python生成艺术图案(分形、数学曲线)
  • 深度相机详解
  • Spring Boot启动失败从循环依赖到懒加载配置的深度排查指南
  • 《Keil 开发避坑指南:STM32 头文件加载异常与 RTE 配置问题全解决》
  • 【译】GitHub Copilot for Azure(预览版)已经在 Visual Studio 2022 中推出
  • 动物专家?单词测试!基于 TensorFlow+Tkinter 的动物识别系统与动物识别小游戏
  • claude-sonnet4和GLM-4-5-HTML版本迷宫小游戏
  • honmony 中集成 tuanjie/unity
  • 自由学习记录(95)
  • Bug 排查日记:从问题浮现到解决的技术之旅
  • C++ opencv RTSP小工具 RTSP流播放、每一帧保存
  • 爆改YOLOv8 | 即插即用的AKConv让目标检测既轻量又提点
  • 光伏运维迎来云端革命!AcrelCloud-1200如何破解分布式光伏四大痛点?
  • Elasticsearch面试精讲 Day 9:复合查询与过滤器优化
  • PPT中如何将设置的文本框边距设为默认
  • 【Javascript】Capacitor 文件存储在 Windows 上的位置
  • Git 同步最新代码:用 stash -> pull -> pop 安全同步更新
  • Docker 容器核心指令与数据库容器化实践
  • 安全运维-云计算系统安全
  • 【1】策略模式 + 模板方法模式的联合应用
  • 具身智能的工程落地:视频-控制闭环的实践路径
  • 手写React状态hook
  • AI测试:自动化测试框架、智能缺陷检测、A/B测试优化
  • 分片上传-
  • Boost搜索引擎 网络库与前端(4)
  • 力扣hot100:搜索二维矩阵 II(常见误区与高效解法详解)(240)
  • OpenBMC之编译加速篇
  • 三、神经网络
  • VisionPro联合编程相机拍照 九点标定实战