原文网址:ElasticSearch--解决this action would add [5] total shards, but this cluster currently has [1000]/[1000_IT利刃出鞘的博客-CSDN博客

简介

本文介绍ElasticSearch总分片数量导致的异常的解决方案。

异常的日志为:this action would add [5] total shards, but this cluster currently has [1000]/[1000

技术资料与交流 ==> 分享靠谱资料:Java真实面试题汇总、精选简历模板、PDF书籍(高清带书签)、精选PPT模板等;分享Java实用技术;帮助优化简历。详见:资料与交流

问题描述

项目里SkyWalking使用ES来存数据,但今天我查看日志时没有今天的数据,只有昨天的,于是我查看SkyWalking的日志(logs/skywalking-oap-server.log),发现如下结果:

[4532]: index [sw_segment-20211201], type [_doc], id [1c8b09ece71a45bd8de74e27a74a6bf6.167.16383242084776012], message [ElasticsearchException[Elasticsearch exception [type=validation_exception, reason=Validation Failed: 1: this action would add [5] total shards, but this cluster currently has [1000]/[1000] maximum shards open;]]]
[4533]: index [sw_log-20211201], type [_doc], id [34a07ac188a8433e865a3bbabb74673a], message [ElasticsearchException[Elasticsearch exception [type=validation_exception, reason=Validation Failed: 1: this action would add [5] total shards, but this cluster currently has [1000]/[1000] maximum shards open;]]]
[4534]: index [sw_segment-20211201], type [_doc], id [1c8b09ece71a45bd8de74e27a74a6bf6.167.16383242085016022], message [ElasticsearchException[Elasticsearch exception [type=validation_exception, reason=Validation Failed: 1: this action would add [5] total shards, but this cluster currently has [1000]/[1000] maximum shards open;]]]
[4535]: index [sw_segment-20211201], type [_doc], id [1c8b09ece71a45bd8de74e27a74a6bf6.167.16383242085336030], message [ElasticsearchException[Elasticsearch exception [type=validation_exception, reason=Validation Failed: 1: this action would add [5] total shards, but this cluster currently has [1000]/[1000] maximum shards open;]]]
[4536]: index [sw_segment-20211201], type [_doc], id [1c8b09ece71a45bd8de74e27a74a6bf6.167.16383242085436040], message [ElasticsearchException[Elasticsearch exception [type=validation_exception, reason=Validation Failed: 1: this action would add [5] total shards, but this cluster currently has [1000]/[1000] maximum shards open;]]]

其异常信息都是:this action would add [5] total shards, but this cluster currently has [1000]/[1000] maximum shards open;

原因分析

ES7.x默认总分片只有1000个,目前已经用完了,导致已经没法创建新的索引了。

解决方案

解决方法就是提高ES的分片数量。

方法1:控制台

PUT /_cluster/settings
{"persistent": {"cluster": {"max_shards_per_node":10000}}
}

persistent:永久生效,transient:临时生效。

方法2:CURL命令

curl --location --request PUT 'http://127.0.0.1:9200/_cluster/settings' \
--header 'Content-Type: application/json' \
--data '{"persistent":{"cluster":{"max_shards_per_node":10000}}}'

persistent:永久生效,transient:临时生效。

其他方法

有人说可以修改配置文件(elasticsearch.yml),添加下边一行

cluster.max_shards_per_node: 10000

但我测试发现 ,没有生效。我通过GET /_cluster/settings?pretty查看,返回结果如下:

{"persistent": {},"transient": {}
}

我的ES版本为:7.15.0

查看是否生效

GET /_cluster/settings?pretty

结果

{"persistent": {"cluster": {"max_shards_per_node": "10000"}},"transient": {}
}

其他网址

this cluster currently has [1946]/[1000] maximum shards open_luoqinglong的专栏-CSDN博客

ElasticSearch--解决this action would add [5] total shards, but this cluster currently has [1000]/[1000相关推荐

  1. es Failed: 1: this action would add [2] total shards, but this cluster currently has [1001]/[1000]

    你用的7版本以上的elasticsearch吧,默认只允许1000个分片,问题是因为集群分片数不足引起的. 现在在elasticsearch.yml中定义 PUT /_cluster/settings ...

  2. ES报错this action would add [2] total shards, but this cluster currently has [5000]/[5000] maximum sha

    文章目录 版本es742,在使用logstash写索引的时候,突然发现logstash日志在报错 报错信息: [2020-06-17T12:01:18,241][WARN ][logstash.out ...

  3. elasticsearch解决控制台中文乱码问题

    elasticsearch解决控制台中文乱码问题 参考文章: (1)elasticsearch解决控制台中文乱码问题 (2)https://www.cnblogs.com/chenmz1995/p/1 ...

  4. 成功解决ValueError: Unable to add relationship because child variable ‘ID‘ in ‘cats_df‘ is also its inde

    成功解决ValueError: Unable to add relationship because child variable 'ID' in 'cats_df' is also its inde ...

  5. 面试精讲之面试考点及大厂真题 - 分布式专栏 17 ElasticSearch解决大数据量检索难题

    17 ElasticSearch解决大数据量检索难题 理想的书籍是智慧的钥匙. --列夫·托尔斯泰 引言 如果你的项目里有超过千万上亿级别的数据,且数据日增量较大需要高性能检索时,如订单数据,你该怎么 ...

  6. Elasticsearch解决只能查询10000条数据以及查询的total为10000条的解决方案

    Elasticsearch官方默认限制索引查询最多只能查询10000条数据,查询第10001条数据开始就会报错: Result window is too large, from + size mus ...

  7. elasticsearch解决同步删除数据库中不存在的数据

    摘要: jdbc-input-plugin 只能实现数据库的追加,对于 elasticsearch 增量写入,但经常jdbc源一端的数据库可能会做数据库删除或者更新操作.这样一来数据库与搜索引擎的数据 ...

  8. 分布式 - ElasticSearch解决大数据量检索难题

    不啰嗦,我们直接开始! 引言 如果你的项目里有超过千万上亿级别的数据,且数据日增量较大需要高性能检索时,如订单数据,你该怎么办? 作为面试官,你需要找一个能解决这个问题的人!为应聘者,你该如何回答面试 ...

  9. ElasticSearch解决去重精度问题 scripted_metric 去重计数脚本计算高效率解决问题(二)

    ElasticSearch scripted_metric 去重计数脚本计算高效率解决问题(二) 11月12日解决问题记录 计数后排序问题暂未解决 话不多说直接贴代码 : init_script 定义 ...

最新文章

  1. events.out.tfevents文件
  2. RabbitMQ安装
  3. Windows网络通信(二):socket异步编程
  4. 远程桌面网关Apache Guacamole 发布1.0.0版本\n
  5. Color the ball
  6. 树莓派摄像头基本操作
  7. Leecode19. 删除链表的倒数第 N 个结点——Leecode大厂热题100道系列
  8. dubbo源码解析-服务暴露原理
  9. 2022,微博稳了吗?
  10. Java 构造函数的详解
  11. 计算机考研复试-计算机组成原理
  12. 解决小米10上 Google Play 卡在正在等待下载,以及从服务器检索信息时出错。DF-DFERH-01的问题
  13. flask爱家租房项目开发(一)
  14. iOS 火星坐标相关整理及解决方案汇总
  15. edge怎么开启沉浸式阅读_美人鼓上舞!端午小长假,豫园将开启史上首次沉浸式国风庙会...
  16. BNET创始人刘建军:BNET破解当今通信网络三大痛点
  17. 好听的歌曲,更新记录听过的音乐。。
  18. 如何查看谷歌网页端保存的密码以及查看xshell连接中的密码
  19. python 基于模板生成ppt_python生成ppt的方法
  20. 愿你千帆历尽归来仍是少年!

热门文章

  1. Unity3d Windows播放视频(视频流)功能组/插件支持对比
  2. 软工1816 · 第八次作业(课堂实战)- 项目UML设计(团队)
  3. MySQL:用户表结构设计
  4. react 访问后端_React框架学习(二)——前后端分离,整合,部署
  5. 最简便windows上传文件到ubuntu
  6. ubuntu 局域网传输文件
  7. 微信小程序适合哪些场景
  8. 单片机原理及应用技术课后答案(5)
  9. OSPF高级特性 —— 修改参考带宽值 + 修改优先级
  10. 部署LVS-DR群集