使用curl命令操作elasticsearch

2021-07-12 05:04:02 字數 3872 閱讀 3047

**

第一:_cat系列

_cat系列提供了一系列查詢elasticsearch集群狀態的介面。你可以通過執行

curl -xget localhost:9200/_cat

獲取所有_cat系列的操作

=^.^=

/_cat/allocation

/_cat/shards

/_cat/shards/

/_cat/master

/_cat/nodes

/_cat/indices

/_cat/indices/

/_cat/segments

/_cat/segments/

/_cat/count

/_cat/count/

/_cat/recovery

/_cat/recovery/

/_cat/health

/_cat/pending_tasks

/_cat/aliases

/_cat/aliases/

/_cat/thread_pool

/_cat/plugins

/_cat/fielddata

/_cat/fielddata/

你也可以後面加乙個v,讓輸出內容**顯示表頭,舉例

name       component        version type url

prometheus analysis-mmseg na j

prometheus analysis-pinyin na j

prometheus analysis-ik na j

prometheus analysis-ik na j

prometheus analysis-smartcn 2.1.0 j

prometheus segmentspy na s /_plugin/segmentspy/

prometheus head na s /_plugin/head/

prometheus bigdesk na s /_plugin/bigdesk/

xandu analysis-ik na j

xandu analysis-pinyin na j

xandu analysis-mmseg na j

xandu analysis-smartcn 2.1.0 j

xandu head na s /_plugin/head/

xandu bigdesk na s /_plugin/bigdesk/

onyxx analysis-ik na j

onyxx analysis-mmseg na j

onyxx analysis-smartcn 2.1.0 j

onyxx analysis-pinyin na j

onyxx head na s /_plugin/head/

onyxx bigdesk na s /_plugin/bigdesk/

第二:_cluster系列

1、查詢設定集群狀態

curl -xget localhost:9200/_cluster/health?pretty=true

pretty=true表示格式化輸出

level=indices 表示顯示索引狀態

level=shards 表示顯示分片資訊

2、curl -xget localhost:9200/_cluster/stats?pretty=true

顯示集群系統資訊,包括cpu jvm等等

3、curl -xget localhost:9200/_cluster/state?pretty=true

集群的詳細資訊。包括節點、分片等。

3、curl -xget localhost:9200/_cluster/pending_tasks?pretty=true

獲取集群堆積的任務

3、修改集群配置

舉例:

curl -xput localhost:9200/_cluster/settings -d '

}'

transient 表示臨時的,persistent表示永久的

4、curl -xpost 『localhost:9200/_cluster/reroute』 -d 『******』

對shard的手動控制,參考

5、關閉節點

關閉指定192.168.1.1節點

關閉主節點

關閉整個集群

delay=10s表示延遲10秒關閉

第三:_nodes系列

1、查詢節點的狀態

第四:索引操作

"" : ,

"name" : ,

"status" : ,

"type" :

} }

}'

curl -xget 'http://localhost:9200///_search' -d ' //查所有 "match_all": {}

curl命令常用操作

curlcurl d username sunnyxd password 12345 url以multipart form data 的方式傳送資料 上傳檔案,f form curl f filename home sunnyxd file.tar.gz f username sunnyxd url...

curl命令操作ElasticSearch總結

埠9200和9300的關係 9200作為http協議埠,用於節點和外部通訊。9300作為tcp協議埠,用於節點與節點之間 節點與tcpclient之間的通訊。cat命令獲取集群資訊 cat系列提供了一系列查詢es集群狀態的介面。你可以通過執行 curl xget localhost 9200 cat...

curl 常用curl命令

前段時間將介面自動化指令碼接入到了jenkins的過程中使用到了curl語法。特此整理了在測試過程中常用到的url命令。curl用法大全 1 可以看到網頁原始碼 2 o可以儲存網頁 3 i可以顯示網頁響應的headers資訊 4 顯示通訊過程 v引數可以顯示一次http通訊的整個過程,包括埠連線和h...