天天看点

【ElasticSearch基础】-- 日常查询&运维操作

目录

​​1 日常查询​​

​​1.1 查询所有索引​​

​​1.2 查看索引信息​​

​​1.3 查询数据​​

​​1.4 打开 index​​

​​1.5 查看 index 配置​​

​​1.6 查看 es 版本​​

​​2 运维​​

​​2.1 集群健康情况​​

​​2.2 查看线程池情况​​

​​2.3 查看pending 的任务​​

​​2.4 查看集群状态​​

​​2.5 查看节点hot_thread​​

​​2.6 查看 segment 的数量(明细和总共 segment 数量)​​

1 日常查询

1.1 查询所有索引

curl 'http://172.16.2.19:9200/_cat/indices?v'

1.2 查看索引信息

curl -sXGET "http://172.16.2.19:9200/_cat/indices/user_02?h=i,p,r"

列名称:索引名称 主分片 副本个数

curl -sXGET "http://172.16.2.19:9200/_cat/indices/test_02"

yellow open test_02 V3--Fg3iTHaZZHv5lU8VAg 3 2 1430397 16 931.9mb 931.9mb

1.3 查询数据

curl '172.16.2.19:9200/spark/_search?q=*&pretty'

1.4 打开 index

POST kindex_2021.06.*/_open?master_timeout=60m

1.5 查看 index 配置

curl 'http://172.16.3.9:9200/us_02/_settings' 

1.6 查看 es 版本

curl 'http://172.16.3.8:9200'

2 运维

2.1 集群健康情况

curl 'http://172.16.3.8:9200/_cluster/health?pretty'

2.2 查看线程池情况

curl 'http://172.16.3.8:9200/_cat/thread_pool' 

2.3 查看pending 的任务

curl 'http://172.16.3.8:9200/_cluster/pending_tasks' 

curl 'http://172.16.3.8:9200/_tasks?detailed=true' 

2.4 查看集群状态

curl 'http://172.16.3.8:9200/_cluster/stats?human&pretty'

2.5 查看节点hot_thread

curl 'http://172.16.3.8:9200/_nodes/hot_threads'

2.6 查看 segment 的数量(明细和总共 segment 数量)

语法:https://www.elastic.co/guide/en/elasticsearch/reference/current/cat-segments.html

curl 'http://172.16.3.98:9200/_cat/segments?v=true'

继续阅读