Elasticsearch 监控主要分为六个层面,分别是集群层、节点层、索引层、分片层、事件层、Sense。Es 监控可以有很多种形式,每个工具的侧重点都不一样,传统的 zabbix 可以监控系统级别的数据、ES 公司推出的商业化监控方案 Marvel、查看索引数据的 head 工具、可视化查询及写入工具 Kibana 等等。
监控相关 API
Elasticsearch 中集群相关的健康、统计等相关的信息都是围绕着 cat API 进行的。
通过 GET 请求发送 cat,下面列出了所有可用的 API:
GET /_cat
=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/indices
/_cat/indices/{index}
/_cat/segments
/_cat/segments/{index}
/_cat/count
/_cat/count/{index}
/_cat/recovery
/_cat/recovery/{index}
/_cat/health
/_cat/pending_tasks
/_cat/aliases
/_cat/aliases/{alias}
/_cat/thread_pool
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
查看 es 集群的索引统计
cat 后面加 indices,更多内容查看 es 查看所有索引情况。
已指定字段的排序方式列出相关统计信息
通过加排序的参数 s 和排序方式 :{desc|asc} 形式返回统计信息,示例内容查看 es(Elasticsearch)以索引名(或指定字段值)进行排序返回。