10集群接口--具体

1集群健康
查看当前集群的健康状态
GET _cluster/health
同样也可以查看某几个索引的健康状态
GET /_cluster/health/test1,test2


2集群状态
查看当前集群的整体状态
$ curl -XGET 'http://localhost:9200/_cluster/state'
默认查看的状态是主机器节点的状态,如果想查看最后的集群状态(如调试),可以直接访问某个机器节点并且添加参数
local=true


3统计信息
查看集群的统计信息,包括内存,机器节点个数,空间大小等各种信息
curl -XGET 'http://localhost:9200/_cluster/stats?human&pretty'


4集群待执行的任务
$ curl -XGET 'http://localhost:9200/_cluster/pending_tasks'


5集群数据重新定位

6集群更新设置
curl -XPUT localhost:9200/_cluster/settings -d '{
    "persistent" : {
        "discovery.zen.minimum_master_nodes" : 2
    }
}'
或者
curl -XPUT localhost:9200/_cluster/settings -d '{
    "transient" : {
        "discovery.zen.minimum_master_nodes" : 2
    }
}'

如果传输了null则代表重置,也就是恢复默认值
curl -XPUT localhost:9200/_cluster/settings -d '{
    "transient" : {
        "discovery.zen.minimum_master_nodes" : null
    }
}'

也可以使用通配符
 curl -XPUT localhost:9200/_cluster/settings -d '{
    "transient" : {
        "discovery.zen.*" : null
    }
}'

查看设置情况
curl -XGET localhost:9200/_cluster/settings


7机器节点统计信息
curl -XGET 'http://localhost:9200/_nodes/stats'
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2/stats'


8机器节点信息
查看所有或者某几台机器节点信息
curl -XGET 'http://localhost:9200/_nodes'
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2'


9当前任务信息
可以查看当前执行的任务信息,或者某几台机器节点当前执行的任务信息
GET _tasks 
GET _tasks?nodes=nodeId1,nodeId2


10机器节点存活线程(hot_threads)
/_nodes/hot_threads


11机器分配解释
查看为什么某个数据节点没有被分配,或者为什么这个数据节点被保留在当前机器上,为什么没有被移动或者合并
查看某个数据节点的分配解释
$ curl -XGET 'http://localhost:9200/_cluster/allocation/explain' -d '{
  "index": "myindex",
  "shard": 0,
  "primary": true
}'

如果没有发送body默认获取第一个没被分配的数据节点的分配详解

猜你喜欢

转载自fenshen6046.iteye.com/blog/2369026