elasticsearch 6.3.2 API-cat

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wanglei_storage/article/details/82462587

elasticsearch 官方提供了各种 API 用于查看集群中的各种状态;这里只介绍_cat API 的使用方法
官网地址:https://www.elastic.co/guide/en/elasticsearch/reference/6.3/cat.html

先来看一下有哪些API

/_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

一、API _cat/allocation

allocation 提供了为每个数据节点分配了多少分片以及它们使用了多少磁盘空间的快照。

shards:分片个数
disk.indices:磁盘索引占用的大小
disk.used:磁盘使用空间
disk.avail:磁盘可用空间
disk.total:磁盘总大小
disk.percent:磁盘占用百分比
host:节点ip地址
ip:节点ip地址
node:节点名称

这里写图片描述


二、API _cat/shards & _cat/shards/{index}

该shards命令是哪些节点包含哪些分片的详细视图。它会告诉您它是主服务器还是副本服务器,文件数,磁盘占用的字节数以及它​​所在的节点。

index:索引的名称
shard:分片的个数(该索引中有5个主分片和1个副本分片)
prirep:r/p分别表示主分片还是副本分片(replicas/primary)
state:分片的状态
docs:文档的数量
store:每个 shard 存储的大小
ip:存储 shard 的节点ip
node:存储 shard 的节点名称

这里写图片描述


三、API _cat/master

master没有任何额外的选择。它只显示主节点ID,绑定IP地址和节点名称。

id:master 节点的标示符
host:master 节点的ip地址
ip:master 节点的ip地址
node:master 节点的名称

这里写图片描述


四、API _cat/nodes

该nodes命令显示集群拓扑,分别包含了每个node的信息

ip:集群中节点的ip骶椎
heap.percent:堆内存的占用百分比
ram.percent:总内存的占用百分比,其实这个不是很准确,因为 buff/cache和available 也被当作使用内存
cpu:cpu占用百分比
load_1m:1分钟内cpu负载
load_5m:5分钟内cpu负载
load_15m:15分钟内cpu负载
node.role:mdi分别表示 master、data、ingest
master:* 代表是master节点,- 代表普通节点
name:节点的名称

这里写图片描述


五、API _cat/tasks

用来查看es集群中的任务列表

action:任务执行的动作
task_id:任务的id号
parent_task_id:父任务的id号,如果为-则表示 tasks_id 即为父任务
type:任务的类型
start_time:任务的启动时间
running_time:任务已经运行的时间
ip:任务运行的节点ip
node:任务运行的节点名称

这里写图片描述


五、API _cat/indices & _cat/indices/{index}

该indices命令提供每个索引的横截面。此信息跨越节点

health:索引的健康值,默认都是green,yellow或者red则表示集群不正常
status:索引状态
index:索引名称
uuid:索引id
pri:索引主分片数
rep:索引副本分片数
docs.count:索引中文档的数量
docs.deleted:索引中删除的文档数量
store.size:索引大小
pri.store.size:主节点存储的大小

这里写图片描述


六、API _cat/segments & _cat/segments/{index}

用来查看集群中索引的分片信息

index:索引名称
shard:索引的分片id,总共有5个分片(0-4)
prirep:p/r 分别表示该分段属于主分片还是副本分片
ip:分片所存储的主机ip
segment:段名称,源自段生成。该名称在内部用于在此段所属的分片的目录中生成文件名
generation:生成号随着写入的每个段递增。段的名称源自此世代号
docs.count:存储在此段中的未删除文档的数量。请注意,这些是Lucene文档,因此计数将包括隐藏文档(例如,来自嵌套类型)
docs.deleted:存储在此段中的已删除文档数。如果此数字大于0,则完全正常,当此段合并时将回收空间
size:此段使用的磁盘空间量
size.memory:分段将一些数据存储到内存中,以便有效地进行搜索。此列显示内存中使用的字节数
committed:段是否已在磁盘上同步。提交的段将在硬重启后继续存在。如果出现错误,则无需担心,来自未提交段的数据也存储在事务日志中,以便Elasticsearch能够在下次启动时重放更改
searchable:如果该段是可搜索的,则为True。值false很可能意味着该段已写入磁盘但从那时起没有进行刷新以使其可搜索
version:已用于编写此段的Lucene版本
compound:段是否存储在复合文件中。如果为true,则表示Lucene将段中的所有文件合并为一个文件以保存文件描述符

这里写图片描述


六、API _cat/count & _cat/count/{index}

提供对整个群集或单个索引的文档计数的快速访问

epoch:索引最近更新的时间戳
timestamp:索引最近更新的时间
count:索引中的文档数量

这里写图片描述


七、API _cat/recovery & _cat/recovery/{index}

该recovery命令是索引分片恢复的视图,包括正在进行和先前已完成的恢复。它是JSON 恢复 API 的更紧凑视图。

只要索引分片移动到群集中的其他节点,就会发生恢复事件。在快照恢复,复制级别更改,节点故障或节点启动期间可能会发生这种情况。最后一种类型称为本地存储恢复,是节点启动时从磁盘加载分片的常用方法。


八、API _cat/health

health是来自的相同信息的简洁,单线表示/_cluster/health。

epoch:集群当前时间戳
timestamp:集群当前时间
cluster:集群名称
status:集群状态
node.total:集群节点数量
node.data:集群数据节点数量
shards:集群总的分片数
pri:主节点总的分片数
relo:
init:初始化的分片
unassign:未分配的分片
pending_tasks:等待期间的任务数
max_task_wait_time:最大任务等待时间
active_shards_percent:活跃的分片百分比

这里写图片描述


九、API _cat/pending_tasks

pending_tasks/_cluster/pending_tasks以方便的表格格式提供与API 相同的信息 。

由于我这边没有等待中的任务,所以数据源参考官方文档

insertOrder:等待任务插入的顺序
timeInQueue:等待任务在队列中的时间
priority:等待任务的优先级
source:任务源信息

insertOrder timeInQueue priority source
       1685       855ms HIGH     update-mapping [foo][t]
       1686       843ms HIGH     update-mapping [foo][t]
       1693       753ms HIGH     refresh-mapping [foo][[t]]
       1688       816ms HIGH     update-mapping [foo][t]
       1689       802ms HIGH     update-mapping [foo][t]
       1690       787ms HIGH     update-mapping [foo][t]
       1691       773ms HIGH     update-mapping [foo][t]

十、API _cat/aliases & _cat/aliases/{index}

aliases 显示有关索引的当前配置别名的信息,包括过滤器和路由信息。
由于该数据本地为空,所以参考官方源数据

alias:别名名称
index:索引名称
filter:
routing.index:
routing.search:

alias  index filter routing.index routing.search
alias1 test1 -      -            -
alias2 test1 *      -            -
alias3 test1 -      1            1
alias4 test1 -      2            1,2

十一、API _cat/thread_pool & _cat/thread_pool/{thread_pools}

该thread_pool命令显示每个节点的群集范围线程池统计信息。默认情况下,为所有线程池返回活动,队列和拒绝的统计信息。

node_name:节点名称
name:线程池名称
active:活跃的线程数
queue:队列中的线程数
rejected:拒绝的线程数

这里写图片描述


十二、API _cat/plugins

该plugins命令提供运行插件的每个节点的视图。此信息跨越节点。
由于es还没有安装插件,所以该信息参考官方文档

name:插件ID
component:插件名称
version:插件版本
description:插件描述信息

name    component               version   description
U7321H6 analysis-icu            6.4.0 The ICU Analysis plugin integrates Lucene ICU module into elasticsearch, adding ICU relates analysis components.
U7321H6 analysis-kuromoji       6.4.0 The Japanese (kuromoji) Analysis plugin integrates Lucene kuromoji analysis module into elasticsearch.
U7321H6 analysis-nori           6.4.0 The Korean (nori) Analysis plugin integrates Lucene nori analysis module into elasticsearch.
U7321H6 analysis-phonetic       6.4.0 The Phonetic Analysis plugin integrates phonetic token filter analysis with elasticsearch.
U7321H6 analysis-smartcn        6.4.0 Smart Chinese Analysis plugin integrates Lucene Smart Chinese analysis module into elasticsearch.
U7321H6 analysis-stempel        6.4.0 The Stempel (Polish) Analysis plugin integrates Lucene stempel (polish) analysis module into elasticsearch.
U7321H6 analysis-ukrainian      6.4.0 The Ukrainian Analysis plugin integrates the Lucene UkrainianMorfologikAnalyzer into elasticsearch.
U7321H6 discovery-azure-classic 6.4.0 The Azure Classic Discovery plugin allows to use Azure Classic API for the unicast discovery mechanism
U7321H6 discovery-ec2           6.4.0 The EC2 discovery plugin allows to use AWS API for the unicast discovery mechanism.
U7321H6 discovery-file          6.4.0 Discovery file plugin enables unicast discovery from hosts stored in a file.
U7321H6 discovery-gce           6.4.0 The Google Compute Engine (GCE) Discovery plugin allows to use GCE API for the unicast discovery mechanism.
U7321H6 ingest-attachment       6.4.0 Ingest processor that uses Apache Tika to extract contents
U7321H6 ingest-geoip            6.4.0 Ingest processor that uses looksup geo data based on ip adresses using the Maxmind geo database
U7321H6 ingest-user-agent       6.4.0 Ingest processor that extracts information from a user agent
U7321H6 mapper-murmur3          6.4.0 The Mapper Murmur3 plugin allows to compute hashes of a field's values at index-time and to store them in the index.
U7321H6 mapper-size             6.4.0 The Mapper Size plugin allows document to record their uncompressed size at index time.
U7321H6 store-smb               6.4.0 The Store SMB plugin adds support for SMB stores.

十二、API _cat/fielddata & _cat/fielddata/{fields}

fielddata 显示集群中每个数据节点上fielddata当前正在使用的堆内存量
我们来看一下 geoip.city_name.keyword 这个字段的信息

id:字段的id
host:字段存储的host
ip:字段存储的ip
node:节点名称
field:字段名称
size:字段占用的堆内存大小

这里写图片描述


十二、API _cat/nodeattrs

该nodeattrs命令显示自定义节点属性

node:节点名称
host:节点host地址
ip:节点ip地址
attr:属性名称
value:属性值

这里写图片描述


十二、API _cat/repositories

该repositories命令显示在群集中注册的快照存储库
由于我本地数据为空,所以参考官方文档

id:快照id
type:快照存储类型

id    type
repo1   fs
repo2   s3

十二、API _cat/repositories

该snapshots命令显示属于特定存储库的所有快照。要查找要查询的可用存储库列表,/_cat/repositories可以使用该命令。查询名为的存储库的快照,由于本地数据为空,参考官方文档:

repo1如下所示:

id:快照名称
status:快照状态
start_epoch:快照创建的时间戳
start_time:快照创建的时间
end_epoch:快照完成的时间戳
end_time:快照完成的时间
duration:快照持续的时间
indices:
success_shards:成功的分片
failed_shards:失败的分片
total_shards:总的分片

id    status   start_epoch   start_time   end_epoch    end_time   duration   indices   success_shards   failed_shards   total_shards
snap1 FAILED   1445616705    18:11:45     1445616978   18:16:18   4.6m       1         4                1               5
snap2 SUCCESS  1445634298    23:04:58     1445634672   23:11:12   6.2m       2         10               0               10

十二、API _cat/templates

该templates命令提供有关现有模板的信息。

name:模版名称
index_patterns:模版匹配(索引匹配之后才可以集成模版)
order:模版引用顺序(数值越高则优先使用)
version:模版版本

例如:我的模板分别为 logstash_web.json 和 logstash.json,order 都为10,匹配规则为 *

这里写图片描述

猜你喜欢

转载自blog.csdn.net/wanglei_storage/article/details/82462587
今日推荐