当前位置:   article > 正文

ES查看集群信息(健康状态、分片、索引等)_es查看集群健康状态

es查看集群健康状态

1、查看集群状态使用频率最高的方法

http://192.168.1.101:9200/  

注意:不同环境的ip不同

 一般我们通过这个方式来验证ES服务器是否启动成功。

2、_cat/health 查看集群健康状态

  1. [root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/health?v
  2. epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
  3. 1657076023 02:53:43 elasticsearch yellow 3 3 5445 2727 0 0 30 0 - 99.5%

参数说明:

  • cluster:集群名称
  • status:集群状态 green 表示集群一切正常;yellow 表示集群不可靠但可用(单节点状态);red 集群不可用,有故障。
  • node.total:节点总数量
  • node.data:数据节点的数量
  • shards:存活的分片数量
  • pri:主分片数量
  • relo:迁移中的分片数量
  • init:初始化中的分片数量
  • unassign:未分配的分片
  • pending_tasks:准备中的任务
  • max_task_wait_time:任务最长等待时间
  • active_shards_percent:激活的分片百分比

3、_cat/shards 查看分片信息

1)、查看所有索引的分片信息

[root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/shards?v

2)、查看指定索引的分片信息

  1. [root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/shards/opt_log?v
  2. index shard prirep state docs store ip node
  3. opt_log 2 p STARTED 870711 88.8mb 192.168.1.101 node01
  4. opt_log 2 r STARTED 870711 88.6mb 192.168.1.103 node03
  5. opt_log 4 p STARTED 869587 88.7mb 192.168.1.101 node01
  6. opt_log 4 r STARTED 869587 89.1mb 192.168.1.103 node03
  7. opt_log 3 p STARTED 870962 88.5mb 192.168.1.101 node01
  8. opt_log 3 r STARTED 870962 88.7mb 192.168.1.102 node02
  9. opt_log 1 p STARTED 870468 88.7mb 192.168.1.101 node01
  10. opt_log 1 r STARTED 870468 88.8mb 192.168.1.103 node03
  11. opt_log 0 p STARTED 869894 88.7mb 192.168.1.101 node01
  12. opt_log 0 r STARTED 869894 89mb 192.168.1.102 node02

参数说明:

  • index:索引名称
  • shard:分片数
  • prirep:分片类型,p为主分片,r为复制分片
  • state:分片状态,STARTED为正常
  • docs:记录数
  • store:存储大小
  • ip:节点ip
  • node:节点名称

4、_cat/nodes 查看集群的节点信息

  1. [root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/nodes?v
  2. ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
  3. 192.168.1.103 83 68 16 1.88 1.16 0.91 mdi - node03
  4. 192.168.1.101 58 67 6 0.33 0.34 0.42 mdi * node01
  5. 192.168.1.102 89 75 16 0.50 0.64 0.66 mdi - node02

参数说明:

  • ip:节点ip
  • heap.percent:堆内存使用百分比
  • ram.percent: 运行内存使用百分比
  • cpu:cpu使用百分比
  • master:带* 表明该节点是主节点,带-表明该节点是从节点
  • name:节点名称

5、_cat/indices 查看索引信息

1)、查看所有索引的分片信息

[root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/indices?v

2)、查看指定索引的分片信息

  1. [root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/indices/opt_log?v
  2. health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
  3. green open opt_log qqRywLNTTvCohc3OxiAZkw 5 1 231 0 2.5kb 1.2kb

参数说明:

  • index: 索引名称
  • docs.count:文档总数
  • docs.deleted:已删除文档数
  • store.size: 存储的总容量
  • pri.store.size:主分片的存储总容量

6、集群命令汇总

[root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat
=^.^=
/_cat/allocation
/_cat/shards
/_cat/shards/{index}
/_cat/master
/_cat/nodes
/_cat/tasks
/_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/thread_pool/{thread_pools}
/_cat/plugins
/_cat/fielddata
/_cat/fielddata/{fields}
/_cat/nodeattrs
/_cat/repositories
/_cat/snapshots/{repository}
/_cat/templates

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/寸_铁/article/detail/882536
推荐阅读
相关标签
  

闽ICP备14008679号