运维常用API。

curl -XGET 'localhost:9200/_cat/indices?v&pretty' #查看索引
curl -XGET 'localhost:9200/_cat/nodes?v&pretty' #查看节点状态
curl -XGET 'localhost:9200/_cluster/health?pretty'   #查看集群状态
curl -XGET 'localhost:9200/_nodes/stats/jvm?pretty=true'   #集群JVM状态

CAT API

简介

JSON对于电脑来说是简单且容易分辨的,但是对于人来说,确十分的难以理解,人眼看到ssh终端的时候,喜欢紧凑对齐的文本,cat API旨在满足这一需求。

常用参数:

详细输出

每一个命令后都可加参数v来打开详细输出,例如:

curl -XGET 'localhost:9200/_cat/master?v&pretty'

查看帮助

每一个命令都可以help来查看用法

curl -XGET 'localhost:9200/_cat/master?help&pretty'

指定列

你也可以定制只输出你关心的某几列(列名支持简单的通配符,比如以name开头的name*)

curl -XGET 'localhost:9200/_cat/nodes?h=ip,port,heapPercent,name&pretty'

更改输出单位

cat默认输出是人类友好的格式,例如输出3.5mb而不是3763212,如果你想看详细数据,请使用如下参数

要更改时间单位,请使用time参数

如果你要更改大小单位,请使用size参数

如果你要使用字节单位,请使用bytes参数

例如

curl 'localhost:9200/_cat/indeces?bytes=b'

更改响应文本

响应为text,json,smile,yaml or cbor

curl '192.168.56.10:9200/_cat/indices?bytes=b'

当前支持的格式(对于?format= 参数): - text (默认) - json - smile - yaml - cbor

你也可以设置"Accept"HTTP header 来指定相应格式例如

curl '192.168.56.10:9200/_cat/indices?pretty' -H "Accept: application/json"

排序

每个命令接收查询字符串参数 s ,该参数为指定参数的值的列进行排序。列通过名称指定,并以逗号分隔的字符串形式提供。默认情况下排序为升序,参数:desc会倒序排列。

curl -XGET 'localhost:9200/_cat/templates?v&s=order:desc,template&pretty'

cat 别名

aliases显示当前别名的配置信息,包含fileter和routing信息

curl -XGET 'localhost:9200/_cat/aliases?v&pretty'

cat 显示用量

allocation选项可已把每台es的分片数,索引大小,磁盘用量以及总量等等展示出来(shards disk.indices disk.used disk.avail disk.total disk.percent host ip node)

curl -XGET 'localhost:9200/_cat/allocation?v&pretty'

cat 记数

若想获得整个集群或者单个索引的文档数,请使用count

curl -XGET 'localhost:9200/_cat/count?v&pretty'

curl -XGET 'localhost:9200/_cat/count/twitter?v&pretty'

注意,文档数只包含活动文档数量。

cat fielddata

展示每个数据节点上的fielddata正在使用多少堆内存

curl -XGET 'localhost:9200/_cat/fielddata?v&pretty'

也可以针对某一字段进行查看

curl -XGET 'localhost:9200/_cat/fielddata?v&fields=body&pretty'

它也接受逗号分隔

curl -XGET 'localhost:9200/_cat/fielddata/body,soul?v&pretty'

cat 健康

health类似/_cluster/health,但是比较简洁,一行展示状态。

curl -XGET 'localhost:9200/_cat/health?v&pretty'

使用ts禁用时间戳

curl -XGET 'localhost:9200/_cat/health?v&ts=0&pretty'

cat indices(查看索引)

indices命令提供每个索引的信息。

curl -XGET 'localhost:9200/_cat/indices/twi*?v&s=index&pretty'

默认情况下,索引统计将显示所有索引的信息,可以提供特定一个pri标志。

那些索引状态是黄色?

curl -XGET 'localhost:9200/_cat/indices?v&health=yellow&pretty'

那个索引拥有最多的文档数

curl -XGET 'localhost:9200/_cat/indices?v&s=docs.count:desc&pretty'

每个索引用掉了多少内存

curl -XGET 'localhost:9200/_cat/indices?v&h=i,tm&s=tm:desc&pretty'

cat master 查看主

master没有任何多余的选项,它只简单的显示出主的id,绑定的地址,和节点名字

curl -XGET 'localhost:9200/_cat/master?v&pretty'

cat nodeattrs

nodeattrs命令展示节点的自定义属性

curl -XGET 'localhost:9200/_cat/nodeattrs?v&pretty'

nodeattrs?h= 可传递指定列,

curl -XGET 'localhost:9200/_cat/nodeattrs?v&h=name,pid,attr,value&pretty'

cat nodes 查看节点

nodes参数用来展示集群拓扑。

curl -XGET 'localhost:9200/_cat/nodes?v&pretty'

我们同样可已用参数nodes?h=来指定显示特定信息。

参数非常的多,而且非常的详细,详见链接。

https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-nodes.html

cat pending tasks待处理任务

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

curl -XGET 'localhost:9200/_cat/pending_tasks?v&pretty'

cat plugins 查看插件

plugins可以查看到你集群中每个节点运行的插件的信息

curl -XGET 'localhost:9200/_cat/plugins?v&s=component&h=name,component,version,description&pretty'

cat recovery

https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-recovery.html

cat repositories 查看存储库

repositories 参数显示在集群中注册的快照存储库:

curl -XGET 'localhost:9200/_cat/repositories?v&pretty'

cat thread pool 查看线程池

默认情况下,返回所有线程池的活动,队列和被拒绝的统计信息。

curl -XGET '192.168.99.11:9200/_cat/thread_pool?v&pretty'

cat shards 查看分片信息

顾名思义,shards选项用来查看分片信息,

curl -XGET '192.168.99.11:9200/_cat/shards?v&pretty'

查看指定索引的情况

curl -XGET '192.168.99.11:9200/_cat/shards/wiki*?v&pretty'

ELASTIC API的更多相关文章

  1. elastic search记录

    安装与启动 插件安装 中文分词器 https://github.com/medcl/elasticsearch-analysis-ik elastic api GET _search { " ...

  2. ELASTIC 动态修改配置API

    工作中使用ELASTIC,我们常有需要修改的配置项,但有时又不想重启elastic,这时候就需要elasticsearch内置的修改集群配置API上场了. 这个API非常的简单. curl -XPUT ...

  3. Elastic Stack 笔记(八)Elasticsearch5.6 Java API

    博客地址:http://www.moonxy.com 一.前言 Elasticsearch 底层依赖于 Lucene 库,而 Lucene 库完全是 Java 编写的,前面的文章都是发送的 RESTf ...

  4. Elastic Search 5.4.3 java api 入门

    首先介绍一点,es的版本从之前的2.x跳跃到5.x,很多插件要保持一致,不然会产生很多版本不兼容的问题. 首先看一个demo先熟悉一下, 具体代码在git服务器上: https://github.co ...

  5. Elastic Search Java Api 创建索引结构,添加索引

    创建TCP客户端 Client client = new TransportClient() .addTransportAddress(new InetSocketTransportAddress( ...

  6. elasticsearch【cat API,系统数据】指令汇总

    本博文讲述的ES获取系统数据的API是基于Elasticsearch 2.4.1版本的. 0. overview a. 下面将要介绍的所有的指令,都支持一个查询参数v(verbose),用来显示详细的 ...

  7. elasticsearch中常用的API

    elasticsearch中常用的API分类如下: 文档API: 提供对文档的增删改查操作 搜索API: 提供对文档进行某个字段的查询 索引API: 提供对索引进行操作,查看索引信息等 查看API: ...

  8. iScroll-5 API 中文版

    http://wiki.jikexueyuan.com/project/iscroll-5/ http://www.mamicode.com/info-detail-331827.html IScro ...

  9. elasticsearch Java API汇总

    http://blog.csdn.net/changong28/article/details/38445805#comments 3.1 集群的连接 3.1.1 作为Elasticsearch节点 ...

随机推荐

  1. freerradius 错误:pap: WARNING: No "known good" password found for the user

    具体错误如下: 1) # Executing section authorize from file /usr/local/etc/raddb/sites-enabled/default(1)   a ...

  2. 源码编译安装mysql5.5.33

    源码编译安装mysql5.5.33 一.安装cmake编译工具 跨平台编译器 # yum install -y gcc* # yum install -y cmake 解决依赖关系 # yum ins ...

  3. maven 跳过test

    -DskipTests,不执行测试用例,但编译测试用例类生成相应的class文件至target/test-classes下. -Dmaven.test.skip=true,不执行测试用例,也不编译测试 ...

  4. PYTHON-文件处理-练习

    ## 一.实现用户注册功能# 思路:# 用户输入用户名.密码# 将用户输入的内容按照固定的格式,比如:egon:123,存入文件# 可以往一个文件中重复注册新的用户名和密码# 附加:# 1.对输入的用 ...

  5. jquery实现星级评分

    项目中遇到到实现星级评分,就用了这个插件 http://www.jq22.com/jquery-info291

  6. Highcharts 使用

    官网:https://www.hcharts.cn/ api:https://api.hcharts.cn/highcharts 效果 html代码 <div id="containe ...

  7. 石头剪刀布(智能判断你是否赢了)(if判断和for)

  8. JS算法之二分查找

    二分查找法主要是解决「在一堆有序的数中找出指定的数」这类问题,不管这些数是一维数组还是 多维数组,只要有序,就可以用二分查找来优化. 二分查找是一种「分治」思想的算法,大概流程如下: 1.数组中排在中 ...

  9. vuejs之v-if-ajax异步请求数据遇到的坑

    场景: params是异步请求获得的数据是一个对象,对象中又有chefHealthInfos数组 渲染时候会报错: 分析: 这是因为可以把v-if看成渲染了两次,两次结果params分别为{},{ch ...

  10. 开始写博客,学习Linq(4)

    应该是可以敲代码了,Linq是.NET Framework3.5的功能,该版本的框架同时发布了新增的和更新了得类库,也为C#和VB.NET语言提供了新版本的编译器.Linq的功能支持源于编译器和类库, ...