1. The most frequently used method to view the cluster status
Note: Different environments have different ip
Generally, we use this method to verify whether the ES server starts successfully.
2. _cat/health View cluster health status
[root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/health?v
epoch timestamp cluster status node.total node.data shards pri relo init unassign pending_tasks max_task_wait_time active_shards_percent
1657076023 02:53:43 elasticsearch yellow 3 3 5445 2727 0 0 30 0 - 99.5%
Parameter Description:
- cluster : cluster name
- status : The cluster status green indicates that the cluster is normal; yellow indicates that the cluster is unreliable but available (single-node status); red indicates that the cluster is unavailable and faulty.
- node.total : total number of nodes
- node.data : the number of data nodes
- shards : the number of surviving shards
- pri : the number of primary shards
- relo : the number of shards in the migration
- init : number of shards in initialization
- unassign : unassigned shard
- pending_tasks : tasks in preparation
- max_task_wait_time : The maximum waiting time for a task
- active_shards_percent : percentage of active shards
3. _cat/shards view shard information
1) View the shard information of all indexes
[root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/shards?v
2) View the shard information of the specified index
[root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/shards/opt_log?v
index shard prirep state docs store ip node
opt_log 2 p STARTED 870711 88.8mb 192.168.1.101 node01
opt_log 2 r STARTED 870711 88.6mb 192.168.1.103 node03
opt_log 4 p STARTED 869587 88.7mb 192.168.1.101 node01
opt_log 4 r STARTED 869587 89.1mb 192.168.1.103 node03
opt_log 3 p STARTED 870962 88.5mb 192.168.1.101 node01
opt_log 3 r STARTED 870962 88.7mb 192.168.1.102 node02
opt_log 1 p STARTED 870468 88.7mb 192.168.1.101 node01
opt_log 1 r STARTED 870468 88.8mb 192.168.1.103 node03
opt_log 0 p STARTED 869894 88.7mb 192.168.1.101 node01
opt_log 0 r STARTED 869894 89mb 192.168.1.102 node02
Parameter Description:
- index: index name
- shard: number of shards
- prirep: shard type, p is the primary shard, r is the copy shard
- state: fragmentation state, STARTED is normal
- docs: number of records
- store: storage size
- ip: node ip
- node: node name
4. _cat/nodes View the node information of the cluster
[root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/nodes?v
ip heap.percent ram.percent cpu load_1m load_5m load_15m node.role master name
192.168.1.103 83 68 16 1.88 1.16 0.91 mdi - node03
192.168.1.101 58 67 6 0.33 0.34 0.42 mdi * node01
192.168.1.102 89 75 16 0.50 0.64 0.66 mdi - node02
Parameter Description:
- ip: node ip
- heap.percent: percentage of heap memory usage
- ram.percent: Percentage of running memory usage
- cpu: cpu usage percentage
- master: with * indicates that the node is the master node, with - indicates that the node is a slave node
- name: node name
5. _cat/indices view index information
1) View the shard information of all indexes
[root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/indices?v
2) View the shard information of the specified index
[root@CENTOS01 ~]# curl http://192.168.1.101:9200/_cat/indices/opt_log?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
green open opt_log qqRywLNTTvCohc3OxiAZkw 5 1 231 0 2.5kb 1.2kb
Parameter Description:
- index: index name
- docs.count: total number of documents
- docs.deleted: number of deleted documents
- store.size: total storage capacity
- pri.store.size: the total storage capacity of the primary shard
6. Summary of cluster commands
[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