eddik 发表于 2019-1-29 08:11:14

elasticsearch 集群indices 分片状态INITIALIZING

  elasticsearch 集群indices 分片状态INITIALIZING,集群状态为: yellow

故障现象

GET /_cat/shards/7a_cool
7a_cool 5r STARTED      4583018 759.4mb 10.2.4.21 pt01-pte-10-2-4-21
7a_cool 17 r INITIALIZING               10.2.4.22 pt01-pte-10-2-4-22《==异常分片
解决办法

1:关闭异常分片主机es 服务;

      登陆pt01-pte-10-2-4-22 主机,/etc/init.d/elasticsearchstop ,发现分片自动迁移至其它主机,但是状态还是在初始化状态,问题依旧存在;   
2:指定分片做主机迁移,

POST /_cluster/reroute
{
"commands": [
{
"move": {
"index": "7a_cool",
"shard": 17,
"from_node": "pt01-pte-10-2-4-22",
"to_node": "pt01-pte-10-2-4-25"
}
}
]
}
发现报错:报错信息如下:

{
"error": {
"root_cause": [
{
"type": "illegal_argument_exception",
"reason": " can't move 17, shard is not started (state = INITIALIZING]"
}
],
"type": "illegal_argument_exception",
"reason": " can't move 17, shard is not started (state = INITIALIZING]"
},
"status": 400
}

    以上信息显示, state = INITIALIZING ,不能移动。   
3:修改分片副本数量

    首先修改indices 副本数为0
此时集群开始调整集群分片,调整完成后集群状态变成:green
PUT 7a_cool/_settings
{
"index": {
"number_of_replicas": "0"
}
}
然后再修改集群indices状态为1

PUT 7a_cool/_settings
{
"index": {
"number_of_replicas": "1"
}
}
集群会再次调整副本数量,调整完成后集群状态依然是:green ,问题解决。


页: [1]
查看完整版本: elasticsearch 集群indices 分片状态INITIALIZING