获取集群的健康状态
curl -s http://localhost:9200/_cat/health?v
类似命令: curl localhost:9200/_cluster/health?pretty
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent1558506494 14:28:14 hdzx_elk green 3 3 8232 4116 0 0 0 0 - 100.0%
- epoch,timestamp 时间戳
- cluster ,集群名称
- status,集群状态 green代表健康;yellow代表分配了所有主分片,但至少缺少一个副本,此时集群数据仍旧完整;red代表部分主分片不可用,可能已经丢失数据。
- node.total,代表在线的节点总数量
- node.data,代表在线的数据节点的数量
- shards, active_shards 存活的分片数量
- pri,active_primary_shards 存活的主分片数量 正常情况下 shards的数量是pri的两倍。
- relo, relocating_shards 迁移中的分片数量,正常情况为 0
- init, initializing_shards 初始化中的分片数量 正常情况为 0
- unassign, unassigned_shards 未分配的分片 正常情况为 0
- pending_tasks,准备中的任务,任务指迁移分片等 正常情况为 0
- max_task_wait_time,任务最长等待时间
- active_shards_percent,正常分片百分比 正常情况为 100%
只有一个正常节点时,
- 会一直是yellow状态;
- 没有多余的节点去放副分片,active_shards_percent 将一直是50%
- init状态的分片也会一直与主分片的数量保持一致。
查看节点
题外话:获取节点 id 的方法。
GET /_cat/nodes?v&h=ip,port,heapPercent,heapMax,id,namecurl localhost:9200/_cat/nodes?v
Elasticsearch索引状态
curl -XGET 'http://localhost:9200/_cat/indices?v'
配置查看
- http://127.0.0.1:9200/_cat/allocation?v
说明:1. shards disk.indices disk.used disk.avail disk.total disk.percent host ip node2. 2 10.1kb 48.8gb 20.1gb 69gb 70 127.0.0.1 127.0.0.1 tez6ctE
- shards 分片
- disk.indices 磁盘索引
- disk.used 磁盘使用过的
- disk.avail 磁盘有效
- disk.total 磁盘总数
- disk.percent 磁盘百分比
- host 主机
- ip ip地址
- node 节点
分片查看
http://127.0.0.1:9200/_cat/shards?v
参考链接:https://blog.csdn.net/weixin_44723434/article/details/90452083
https://www.cnblogs.com/kevingrace/p/10671063.html
