温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

elasticsearch 集群indices 分片状态INITIALIZING

发布时间:2020-05-24 14:12:13 来源:网络 阅读:28174 作者:无锋剑 栏目:大数据

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 ,问题解决。
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI