如果发现yellow状态有未分配的分片,可以先用以下命令查询一下原因
curl -XGET 'http://15.31.213.92:9200/_cluster/allocation/explain?pretty'
我有个索引很大将近4个G,新增了2个节点后有一些分片同步很慢,变成黄色。打印如下信息,但是过了一会还是把分片同步过去了。如果发现浅黄色的分片,可以多等等看看
[root@localhost logs]# curl -XGET 'http://15.31.213.92:9200/_cluster/allocation/explain?pretty'
{
"index" : "index_execution",
"shard" : 2,
"primary" : false,
"current_state" : "unassigned",
"unassigned_info" : {
"reason" : "CLUSTER_RECOVERED",
"at" : "2019-12-26T11:01:43.051Z",
"last_allocation_status" : "no_attempt"
},
"can_allocate" : "throttled",
"allocate_explanation" : "allocation temporarily throttled",
"node_allocation_decisions" : [
{
"node_id" : "NfmBH4nSSpGmtf7aPNuvXQ",
"node_name" : "mastersha",
"transport_address" : "15.32.134.247:9300",
"node_decision" : "throttled",
"deciders" : [
{
"decider" : "throttling",
"decision" : "THROTTLE",
"explanation" : "reached the limit of incoming shard recoveries [2], cluster setting [cluster.routing.allocation.node_concurrent_incoming_recoveries=2] (can also be set via [cluster.routing.allocation.node_concurrent_recoveries])"
}
]
},
{
"node_id" : "dTmMi9PFQvm7gwWAlwLoNw",
"node_name" : "node1sha",
"transport_address" : "15.32.134.247:9301",
"node_decision" : "throttled",
"deciders" : [
{
"decider" : "throttling",
"decision" : "THROTTLE",
"explanation" : "reached the limit of outgoing shard recoveries [2] on the node [dTmMi9PFQvm7gwWAlwLoNw] which holds the primary, cluster setting [cluster.routing.allocation.node_concurrent_outgoing_recoveries=2] (can also be set via [cluster.routing.allocation.node_concurrent_recoveries])"
}
]
},
{
"node_id" : "RTo9hlxXQ_yyqwZYMV2PkA",
"node_name" : "master",
"transport_address" : "15.31.213.92:9300",
"node_decision" : "no",
"store" : {
"matching_sync_id" : true
},
"deciders" : [
{
"decider" : "same_shard",
"decision" : "NO",
"explanation" : "the shard cannot be allocated to the same node on which a copy of the shard already exists [[index_execution][2], node[RTo9hlxXQ_yyqwZYMV2PkA], [P], s[STARTED], a[id=kngSdLpRRDqxNIHHm7LJog]]"
},
{
"decider" : "throttling",
"decision" : "THROTTLE",
"explanation" : "reached the limit of outgoing shard recoveries [2] on the node [RTo9hlxXQ_yyqwZYMV2PkA] which holds the primary, cluster setting [cluster.routing.allocation.node_concurrent_outgoing_recoveries=2] (can also be set via [cluster.routing.allocation.node_concurrent_recoveries])"
}
]
}
]
}
[root@localhost logs]#
[root@localhost logs]#
[root@localhost logs]#
[root@localhost logs]#
[root@localhost logs]# curl -XGET 'http://15.31.213.92:9200/_cluster/allocation/explain?pretty'
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "unable to find any unassigned shards to explain [ClusterAllocationExplainRequest[useAnyUnassignedShard=true,includeYesDecisions?=false]"
}
],
"type" : "illegal_argument_exception",
"reason" : "unable to find any unassigned shards to explain [ClusterAllocationExplainRequest[useAnyUnassignedShard=true,includeYesDecisions?=false]"
},
"status" : 400
}
[root@localhost logs]# curl -XGET 'http://15.31.213.92:9200/_cluster/allocation/explain?pretty'
{
"error" : {
"root_cause" : [
{
"type" : "illegal_argument_exception",
"reason" : "unable to find any unassigned shards to explain [ClusterAllocationExplainRequest[useAnyUnassignedShard=true,includeYesDecisions?=false]"
}
],
"type" : "illegal_argument_exception",
"reason" : "unable to find any unassigned shards to explain [ClusterAllocationExplainRequest[useAnyUnassignedShard=true,includeYesDecisions?=false]"
},
"status" : 400
}
[root@localhost logs]#