运维常用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. maven项目提示web.xml is missing或红色感叹号

    1.web.xml is missing and <failOnMissingWebXml> is set to true 提示信息应该能看懂.也就是缺少了web.xml文件,<fa ...

  2. 通达OA系统myisam转innodb引擎

    OA系统切换到linux环境后,性能提升了2-3倍左右,随着公司的发展壮大,办公人员也会越来越多,当人数达到一定数量级别时如1500在线人数已无法支撑公司业务,就需要对系统进行性能提升优化. 当前OA ...

  3. Expm 9_1 有向图中环的判断问题

    [问题描述] 给定一个有向图,要求使用深度优先搜索策略,判断图中是否存在环. package org.xiu68.exp.exp9; public class Exp9_1 { //用深度优先搜索判断 ...

  4. IntelliJ IDEA创建JavaWeb工程及配置Tomcat部署

    步骤: 在WEB-INF 下创建classes 和 lib 两个文件夹 右上角一个蓝色的按钮... Modules选项卡,Paths下的配置...输出路径选择classes Dependencies选 ...

  5. 并发研究之Java内存模型(Java Memory Model)

    Java内存模型JMM java内存模型定义 上一遍文章我们讲到了CPU缓存一致性以及内存屏障问题.那么Java作为一个跨平台的语言,它的实现要面对不同的底层硬件系统,设计一个中间层模型来屏蔽底层的硬 ...

  6. 认识js运动

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. 步步为营-54-DOM

    说明:DOM document object model 文档对象模型.将所有的标记加载到内存中,以树形结构处理 1.1 使用JavaScript操作DOM,主要包括两个部分 Browser对象:BO ...

  8. 单一职责原则(Simple responsibility pinciple, SRP)

    一个类只负责一个功能领域中的相应职责 未完待续

  9. Linux下apache支持PHP配置

    https://www.cnblogs.com/qiuxiao/p/6815350.html https://www.cnblogs.com/polestar/p/6086552.html

  10. URL中带加号的处理

    问题起因:      客户订购了一关键字为"e+h 变送器" , 在首页推荐广告中,会根据用户在search 搜索过的关键字进行一个匹配投放.技术实现是UED 通过JS 获取coo ...