ELASTIC API
运维常用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的更多相关文章
- elastic search记录
安装与启动 插件安装 中文分词器 https://github.com/medcl/elasticsearch-analysis-ik elastic api GET _search { " ...
- ELASTIC 动态修改配置API
工作中使用ELASTIC,我们常有需要修改的配置项,但有时又不想重启elastic,这时候就需要elasticsearch内置的修改集群配置API上场了. 这个API非常的简单. curl -XPUT ...
- Elastic Stack 笔记(八)Elasticsearch5.6 Java API
博客地址:http://www.moonxy.com 一.前言 Elasticsearch 底层依赖于 Lucene 库,而 Lucene 库完全是 Java 编写的,前面的文章都是发送的 RESTf ...
- Elastic Search 5.4.3 java api 入门
首先介绍一点,es的版本从之前的2.x跳跃到5.x,很多插件要保持一致,不然会产生很多版本不兼容的问题. 首先看一个demo先熟悉一下, 具体代码在git服务器上: https://github.co ...
- Elastic Search Java Api 创建索引结构,添加索引
创建TCP客户端 Client client = new TransportClient() .addTransportAddress(new InetSocketTransportAddress( ...
- elasticsearch【cat API,系统数据】指令汇总
本博文讲述的ES获取系统数据的API是基于Elasticsearch 2.4.1版本的. 0. overview a. 下面将要介绍的所有的指令,都支持一个查询参数v(verbose),用来显示详细的 ...
- elasticsearch中常用的API
elasticsearch中常用的API分类如下: 文档API: 提供对文档的增删改查操作 搜索API: 提供对文档进行某个字段的查询 索引API: 提供对索引进行操作,查看索引信息等 查看API: ...
- iScroll-5 API 中文版
http://wiki.jikexueyuan.com/project/iscroll-5/ http://www.mamicode.com/info-detail-331827.html IScro ...
- elasticsearch Java API汇总
http://blog.csdn.net/changong28/article/details/38445805#comments 3.1 集群的连接 3.1.1 作为Elasticsearch节点 ...
随机推荐
- nagios系列(八)之nagios通过nsclient监控windows主机
nagios通过nsclient监控windows主机 1.下载NSClient -0.3.8-Win32.rar安装在需要被监控的windows主机中 可以设置密码,此处密码留空 2.通过在nagi ...
- 容器平台选型的十大模式:Docker、DC/OS、K8S 谁与当先?【转】
网易企业服务2017-10-13 无论是在社区,还是在同客户交流的过程中,总会被问到到底什么时候该用 Docker?什么时候用虚拟机?如果使用容器,应该使用哪个容器平台? 显而易见,我不会直接给大家一 ...
- CSS三:CSS的三种引入方式
CSS的引入方式共有三种:行内样式.内部样式表.外部样式表. 一.行内样式 使用style属性引入CSS样式. 示例:<h1 style="color:red;">st ...
- Best quotes from The Vampire Diary(《吸血鬼日记》经典台词)
1. I will start fresh, be someone new. 1. 我要重新开始,做不一样的自己. 2. It's the only way I'll make it through. ...
- web----框架基础
Web框架本质: 众所周知,对于所有的Web应用,本质上其实就是一个socket服务端,用户的浏览器其实就是一个socket客户端. 真实开发中的python web程序来说,一般会分为两部分:服务器 ...
- cf276E 两棵线段树分别维护dfs序和bfs序,好题回头再做
搞了一晚上,错了,以后回头再来看 /* 对于每次更新,先处理其儿子方向,再处理其父亲方向 处理父亲方向时无法达到根,那么直接更新 如果能达到根,那么到兄弟链中去更新,使用bfs序 最后,查询结点v的结 ...
- pytest四:fixture_yield 实现 teardown
既然有 setup 那就有 teardown,fixture 里面的 teardown 用 yield 来唤醒 teardown的执行 在所有用例执行完后执行:yield import pytest ...
- springMVC3学习--ModelAndView对象(转)
原文链接:springMVC3学习(二)--ModelAndView对象 当控制器处理完请求时,通常会将包含视图名称或视图对象以及一些模型属性的ModelAndView对象返回到DispatcherS ...
- JavaScript中的短路
短路:逻辑运算从左到右.逻辑或运算,当左边的条件成立时,后面的条件将不再参与运算. 因此在逻辑或运算中,尽量将条件结果为true的放第一位.而在逻辑与运算中,尽量将条件结果为false的放到第一位. ...
- Code alignment 代码对齐改进(VS2017)
In mathematics you always keep your equals lined up directly underneath the one above. It keeps it c ...