描述:
通过接口访问,查看 es 单机和集群状态,十分方便。
常用接口:
配置查看 - http://127.0.0.1:9200/_cat/allocation?v
shards disk.indices disk.used disk.avail disk.total disk.percent host ip node
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
index shard prirep state docs store ip node
grwegew 0 p STARTED 1 3.4kb 127.0.0.1 tez6ctE
dqadq 0 p STARTED 2 6.6kb 127.0.0.1 tez6ctE
具体索引分片 - http://127.0.0.1:9200/_cat/shards/{index}?v
index shard prirep state docs store ip node
grwegew 0 p STARTED 1 3.4kb 127.0.0.1 tez6ctE
_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}
- /_cat/nodeattrs
- /_cat/repositories
- /_cat/snapshots/{repository}
verbose
每个命令都支持使用 ?v 参数,来显示详细的信息:
$ curl localhost:9200/_cat/master?v
help
每个命令都支持使用 help 参数,来输出可以显示的列:
$ curl localhost:9200/_cat/master?help
headers
通过 h 参数,可以指定输出的字段:
$ curl localhost:9200/_cat/master?v
$ curl localhost:9200/_cat/master?h=ip,node
数字类型的格式化
很多的命令都支持返回可读性的大小数字,比如使用 mb 或者 kb 来表示。
$ curl localhost:9200/_cat/indices?v