• green: 主副分片都正常分配
  • yellow: 主分片都正常分配, 但是有副本分片没有正常分配
  • red: 有主分片没有分配 ```java

    一些集群和节点的统计信息

    Node Stats:

    GET _nodes/stats

Cluster Stats:

GET _cluster/stats

索引级别的统计信息

Index Stats:

GET kibana_sample_data_ecommerce/_stats

查看pending的任务

Pending Cluster Tasks API:

GET _cluster/pending_tasks

查看所有的 tasks,也支持 cancel task

GET _tasks

查看线程池的

GET _nodes/thread_pool GET _nodes/stats/thread_pool GET _cat/thread_pool?v

查看热点线程

GET _nodes/hot_threads GET _nodes/stats/thread_pool

  1. 健康状态
  2. ```shell
  3. GET /_cluster/health查看
  4. {
  5. "cluster_name": "re***rch", # 集群名称
  6. "status": "green", # 集群状态
  7. "timed_out": false, # 如果false响应在timeout参数指定的时间段内返回(30s默认情况下)
  8. "number_of_nodes": 3, # 集群中的节点数
  9. "number_of_data_nodes": 3, # 作为数据节点的节点数
  10. "active_primary_shards": 6, # 活动主分区的数量
  11. "active_shards": 12, # 活动主分区和副本分区的总数
  12. "relocating_shards": 0, # 正在重定位的分片的数量
  13. "initializing_shards": 0, # 正在初始化的分片数
  14. "unassigned_shards": 0, # 未分配的分片数
  15. "delayed_unassigned_shards": 0, # 其分配因超时设置而延迟的分片数
  16. "number_of_pending_tasks": 0, #尚未执行的集群级别更改的数量
  17. "number_of_in_flight_fetch": 0, # 未完成的访存数量
  18. "task_max_waiting_in_queue_millis": 0, # 自最早的初始化任务等待执行以来的时间
  19. "active_shards_percent_as_number": 100 # 群集中活动碎片的比率,以百分比表示
  20. }

设置慢查询

  1. # 触发这些的会被记录
  2. PUT my_index/
  3. {
  4. "settings": {
  5. "index.search.slowlog.threshold": {
  6. "query.warn": "10s",
  7. "query.info": "3s",
  8. "query.debug": "2s",
  9. "query.trace": "0s",
  10. "fetch.warn": "1s",
  11. "fetch.info": "600ms",
  12. "fetch.debug": "400ms",
  13. "fetch.trace": "0s"
  14. }
  15. }
  16. }