0
点赞
收藏
分享

微信扫一扫

ES常用查询

古得曼_63b6 2022-12-12 阅读 207
  • 查询集群状态命令:

curl -XGET "http://127.0.0.1:9200/_cluster/health?pretty"

  • 查询Es全局状态: curl -XGET "http://127.0.0.1:9200/_cluster/stats?pretty"
  • 查询集群设置 curl -XGET "http://127.0.0.1:9200/_cluster/settings?pretty"
  • 查看集群文档总数 curl -XGET "http://127.0.0.1:9200/_cat/count?v"
  • 查看集群别名组 curl -XGET "http://127.0.0.1:9200/_cat/aliases"
  • 查看当前集群索引分片信息,注:查看某一个索引可用shards/索引名? curl -XGET "http://127.0.0.1:9200/_cat/shards?v"
  • 查看集群实例存储详细信息 curl -XGET "http://127.0.0.1:9200/_cat/allocation?v"
  • 查看当前集群的所有实例 curl -XGET "http://127.0.0.1:9200/_cat/nodes?v"
  • 查看某索引分片转移进度 curl -XGET "http://127.0.0.1:9200/_cat/recovery/索引名?v"
  • 查看当前集群等待任务 curl -XGET "http://127.0.0.1:9200/_cat/pending_tasks?v"
  • 查看集群写入线程池任务 curl -XGET "http://127.0.0.1:9200/_cat/thread_pool/write?v"
  • 查看集群查询线程池任务 curl -XGET "http://127.0.0.1:9200/_cat/thread_pool/search?v"
  • 查看分片未分配的原因 curl -XGET "http://127.0.0.1:9200/_cat/shards?v&h=index,shard,prirep,state,node,unassigned.reason" | grep UNASSIGNED
  • 查看具体原因

• curl -XGET "http://127.0.0.1:9200/_cluster/allocation/explain?pretty" -d '{"index":"pm_perf_itemrawinfo_20211004","shard":1,"primary":true}' -H 'Content-Type: application/json'

索引

  • 查询索引mapping和settings

• curl -XGET http://127.0.0.1:9200/test2?pretty

  • 查询索引settings

• curl -XGET "http://127.0.0.1:9200/test2/_settings?pretty"

  • 查看分片未分配详细命令

• curl -XGET "http://127.0.0.1:9200/_cluster/allocation/explain?pretty" -H 'Content-Type:application/json' -d '{"index": "indexname","shard": 17,"primary": true}'

允许1000个shard; 但数量过多可能会对master 产生更大压力, 不会发挥出更好的性能; 另根据官方说法, 建议是节点上不超过 20 shard / JVM_GB

举报

相关推荐

0 条评论