ES创建index报错cluster currently has 4/2 maximum shard

原文链接

IT思维

前提

调试业务服务期间,服务日志需要写入es集群,发现数据写入报错。

报错内容如下

ElasticsearchDeprecationWarning: In a future major version, this request will fail because this action would add [10] total shards, but this cluster currently has [20242]/[20000] maximum shards open. Before upgrading, reduce the number of shards in your cluster or adjust the cluster setting [cluster.max_shards_per_node].

报错内容分析

根据报错内容描述可以看出,是es集群分片数量达到上限导致报错。

解决办法有以下几种:

1:删除集群无用index,减少集群分片数量;
2:修改集群index 默认数量,或者修改现有index分片数量;
3:修改集群分片数量上限;

调整集群最大分片数

本次采用临时快速解决方案,解决办法如下:

查看现在集群分片数

以下操作在kibana devtool 空间操作
GET _cluster/stats?filter_path=*indices*

{
  "indices" : {
    "count" : 1740,
    "shards" : {
      "total" : 20242,     <<<<<<=====现使用分片数量

修改集群最大分片数

PUT _cluster/settings
{
    "transient" : 
        {
      "cluster.max_shards_per_node": "2000"
        }
}

结论:

以上操作完成,可以快速应对集群创建index 报分片数量过多问题。另外es集群分片数量设置是否合理,需要参考集群节点数量,数据量、节点内存大小等信息,不在本文阐述。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值