日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

ELASTIC API

發(fā)布時間:2023/12/18 编程问答 23 豆豆
生活随笔 收集整理的這篇文章主要介紹了 ELASTIC API 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

運維常用API。

curl -XGET 'localhost:9200/_cat/indices?v&pretty' #查看索引
curl -XGET 'localhost:9200/_cat/nodes?v&pretty' #查看節(jié)點狀態(tài)
curl -XGET 'localhost:9200/_cluster/health?pretty' ? #查看集群狀態(tài)
curl -XGET?'localhost:9200/_nodes/stats/jvm?pretty=true' ? #集群JVM狀態(tài)

?

CAT API

簡介

JSON對于電腦來說是簡單且容易分辨的,但是對于人來說,確十分的難以理解,人眼看到ssh終端的時候,喜歡緊湊對齊的文本,cat API旨在滿足這一需求。

常用參數(shù):

詳細輸出

每一個命令后都可加參數(shù)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,如果你想看詳細數(shù)據(jù),請使用如下參數(shù)

要更改時間單位,請使用time參數(shù)

如果你要更改大小單位,請使用size參數(shù)

如果你要使用字節(jié)單位,請使用bytes參數(shù)

例如

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

?

更改響應文本

響應為text,json,smile,yaml or cbor

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

當前支持的格式(對于?format= 參數(shù)): - text (默認) - json - smile - yaml - cbor

你也可以設置"Accept"HTTP header 來指定相應格式例如

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

?

排序

每個命令接收查詢字符串參數(shù) s ,該參數(shù)為指定參數(shù)的值的列進行排序。列通過名稱指定,并以逗號分隔的字符串形式提供。默認情況下排序為升序,參數(shù):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的分片數(shù),索引大小,磁盤用量以及總量等等展示出來(shards disk.indices disk.used disk.avail disk.total disk.percent host ip node)

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

?

cat 記數(shù)

若想獲得整個集群或者單個索引的文檔數(shù),請使用count

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

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

注意,文檔數(shù)只包含活動文檔數(shù)量。

?

cat fielddata

展示每個數(shù)據(jù)節(jié)點上的fielddata正在使用多少堆內(nèi)存

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,但是比較簡潔,一行展示狀態(tài)。

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'

默認情況下,索引統(tǒng)計將顯示所有索引的信息,可以提供特定一個pri標志。

那些索引狀態(tài)是黃色?

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

那個索引擁有最多的文檔數(shù)

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

每個索引用掉了多少內(nèi)存

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

?

cat master 查看主

master沒有任何多余的選項,它只簡單的顯示出主的id,綁定的地址,和節(jié)點名字

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

?

cat nodeattrs

nodeattrs命令展示節(jié)點的自定義屬性

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 查看節(jié)點

nodes參數(shù)用來展示集群拓撲。

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

我們同樣可已用參數(shù)nodes?h=來指定顯示特定信息。

參數(shù)非常的多,而且非常的詳細,詳見鏈接。

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可以查看到你集群中每個節(jié)點運行的插件的信息

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 參數(shù)顯示在集群中注冊的快照存儲庫:

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

?

cat thread pool 查看線程池

默認情況下,返回所有線程池的活動,隊列和被拒絕的統(tǒng)計信息。

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'

?

?

轉載于:https://www.cnblogs.com/kerwinC/p/6473388.html

創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎

總結

以上是生活随笔為你收集整理的ELASTIC API的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。