返回介绍

PART Ⅰ : 容器云OPENSHIFT

PART Ⅱ:容器云 KUBERNETES

PART Ⅲ:持续集成与持续部署

PART Ⅴ:日志/监控/告警

PART Ⅵ:基础

PART Ⅶ:数据存储、处理

PART VIII:CODE

PART X:HACKINTOSH

PART XI:安全

_cat

发布于 2024-06-08 21:16:46 字数 4856 浏览 0 评论 0 收藏 0

官方文档:https://www.elastic.co/guide/en/elasticsearch/reference/current/cat.html

查看_cat API支持的所有Endpoint

GET /_cat
curl -XGET http://127.0.0.1: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

查询Endpoint参数

GET /_cat/health?help
curl -XGET "http://127.0.0.1:9200/_cat/health?help"


# 参数全称             | 参数缩写                                   | 参数详解
----------------------------------------------------------------------------------------------------
epoch                 | t,time                                   | seconds since 1970-01-01 00:00:00  
timestamp             | ts,hms,hhmmss                            | time in HH:MM:SS                   
cluster               | cl                                       | cluster name                       
status                | st                                       | health status                      
node.total            | nt,nodeTotal                             | total number of nodes              
node.data             | nd,nodeData                              | number of nodes that can store data
shards                | t,sh,shards.total,shardsTotal            | total number of shards             
pri                   | p,shards.primary,shardsPrimary           | number of primary shards           
relo                  | r,shards.relocating,shardsRelocating     | number of relocating nodes         
init                  | i,shards.initializing,shardsInitializing | number of initializing nodes       
unassign              | u,shards.unassigned,shardsUnassigned     | number of unassigned shards        
pending_tasks         | pt,pendingTasks                          | number of pending tasks            
max_task_wait_time    | mtwt,maxTaskWaitTime                     | wait time of longest task pending  
active_shards_percent | asp,activeShardsPercent                  | active number of shards in percent 

使用参数控制查询条件

GET /_cat/health?h=st,t
#带表头
GET /_cat/health?v&h=st,t

控制查询的输出排序

GET _cat/indices?v&h=index,store.size,creation.date&s=store.size:desc,creation.date
# 查询出来的Index将会以store.size的大小降序输出。只输出Index名,store.size大小,创建时间戳

curl -XGET "http://elasticsearch-service.logger.svc:9200/_cat/indices?v&h=index,store.size,creation.date&s=store.size:desc,creation.date"

控制查询的输出格式

GET _cat/indices?v&h=index,store.size,creation.date&s=store.size:desc,creation.date&format=yaml
  • yaml
      - index: "test-test-2019.05.21"
        store.size: "4.1gb"
        creation.date: "1558432572904"
      - index: ".monitoring-es-7-2019.06.17"
        store.size: "1.2gb"
        creation.date: "1560729605158"
    
  • json
      [
      {
          "index" : "test-test-2019.05.21",
          "store.size" : "4.1gb",
          "creation.date" : "1558432572904"
      },
      {
          "index" : ".monitoring-es-7-2019.06.17",
          "store.size" : "1.2gb",
          "creation.date" : "1560729605158"
      }
      ]
    
  • text (default)
      index                           store.size creation.date
      test-test-2019.05.21                 4.1gb 1558432572904
      .monitoring-es-7-2019.06.17          1.2gb 1560729605158
    
  • cbor
  • smile

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文