es分片迁移_elasticsearch 集群indices 分片状态INITIALIZING

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

故障现象

GET /_cat/shards/7a_cool

7a_cool 5 r 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/elasticsearch stop ,发现分片自动迁移至其它主机,但是状态还是在初始化状态,问题依旧存在;

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": "[move_allocation] can't move 17, shard is not started (state = INITIALIZING]"

}

],

"type": "illegal_argument_exception",

"reason": "[move_allocation] 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 ,问题解决。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值