29-Elasticsearch 集群监控

Elasticsearch Stats 相关的 API

● Elasticsearch 提供了多个监控相关的 API

Node Stats: _nodes/stats

Cluster Stats: _cluster/stats

Index Stats: index_name/_stats

Elasticsearch Task API

● 查看 Task 相关的 API

Pending Cluster Tasks API: GET _cluster/pending_tasks

Task Management API:GET _tasks (可以用来 Cancel 一个 Task)

● 监控 Thread Pools

○ GET _nodes/thread_pool

○ GET _nodes/stats/thread_pool

○ GET _cat/thread_pool?v

○ GET _nodes/hot_threads

The Index & Query Slow Log

● 支持将分片上, Search 和 Fetch 阶段的慢 查询写入文件

● 支持为 Query 和 Fetch 分别定义阈值

● 索引级的动态设置,可以按需设置,或者通过Index Template 统一设定

● Slow log 文件通过 log4j2.properties 配 置

复制代码
# 设置 Index Slowlogs
# the first 1000 characters of the doc's source will be logged
PUT my_index/_settings
{
  "index.indexing.slowlog":{
    "threshold.index":{
      "warn":"10s",
      "info": "4s",
      "debug":"2s",
      "trace":"0s"
    },
    "level":"trace",
    "source":1000  
  }
}

# 设置查询
DELETE my_index
//"0" logs all queries
PUT my_index/
{
  "settings": {
    "index.search.slowlog.threshold": {
      "query.warn": "10s",
      "query.info": "3s",
      "query.debug": "2s",
      "query.trace": "0s",
      "fetch.warn": "1s",
      "fetch.info": "600ms",
      "fetch.debug": "400ms",
      "fetch.trace": "0s"
    }
  }
}
相关推荐
Elastic 中国社区官方博客15 小时前
你的 AI agent 不需要你的 API 密钥:使用 OAuth 2.1 对 Elasticsearch MCP 服务器进行身份验证
大数据·运维·人工智能·elasticsearch·搜索引擎·全文检索
互联网中的一颗神经元20 小时前
ZZ — Git 速查表
大数据·git·elasticsearch
Elasticsearch1 天前
跳过有状态的 OTel Collector:Elasticsearch 9.5 原生存储两种指标时间类型
elasticsearch
C++、Java和Python的菜鸟1 天前
第2章 项目前置课-代码版本控制Git
大数据·elasticsearch·搜索引擎
Elasticsearch2 天前
什么是混合搜索?
elasticsearch
Elasticsearch2 天前
从点击流中提升搜索相关性:使用 Learn To Rank 和 OpenTelemetry 行为信号
elasticsearch
倒流时光三十年2 天前
第六阶段 57 · ES|QL 与 SQL API(用 SQL 查 ES)
数据库·sql·elasticsearch
Elastic 中国社区官方博客2 天前
我们如何重构 APM 服务地图以应对事件响应:Observability 9.5 背后的设计故事
大数据·人工智能·elasticsearch·重构·全文检索
guwentian2 天前
Git Worktree 实战:用并行多 Agent 把开发提速 N 倍
大数据·git·elasticsearch·wroktree
Elastic 中国社区官方博客2 天前
Elasticsearch:使用 AI Agent 来创建 workflow
大数据·运维·人工智能·elasticsearch·搜索引擎·自动化·全文检索