Elasticsearch 未分配分片 CircuitBreakingException[[parent] 数据太大

2023-12-29

我收到警报,指出 elasticsearch 有 2 个未分配的分片。我进行了以下 api 调用以收集更多详细信息。

    curl -s http://localhost:9200/_cluster/allocation/explain | python -m json.tool

输出如下

    "allocate_explanation": "cannot allocate because allocation is not permitted to any of the nodes",
    "can_allocate": "no",
    "current_state": "unassigned",
    "index": "docs_0_1603929645264",
    "node_allocation_decisions": [
        {
            "deciders": [
                {
                    "decider": "max_retry",
                    "decision": "NO",
                    "explanation": "shard has exceeded the maximum number of retries [5] on failed allocation attempts - manually call [/_cluster/reroute?retry_failed=true] to retry, [unassigned_info[[reason=ALLOCATION_FAILED], at[2020-10-30T06:10:16.305Z], failed_attempts[5], delayed=false, details[failed shard on node [o_9jyrmOSca9T12J4bY0Nw]: failed recovery, failure RecoveryFailedException[[docs_0_1603929645264][0]: Recovery failed from {elasticsearch-data-1}{fIaSuZsNTwODgZnt90f7kQ}{Qxl9iPacQVS-tN_t4YJqrw}{IP1}{IP:9300} into {elasticsearch-data-0}{o_9jyrmOSca9T12J4bY0Nw}{1w5mgwy0RYqBQ9c-qA_6Hw}{IP}{IP:9300}]; nested: RemoteTransportException[[elasticsearch-data-1][IP:9300][internal:index/shard/recovery/start_recovery]]; nested: RecoveryEngineException[Phase[1] phase1 failed]; nested: RecoverFilesRecoveryException[Failed to transfer [129] files with total size of [4.4gb]]; nested: RemoteTransportException[[elasticsearch-data-0][IP2:9300][internal:index/shard/recovery/file_chunk]]; nested: 
CircuitBreakingException[[parent] Data too large, data for [<transport_request>] would be [1972835086/1.8gb], which is larger than the limit of [1972122419/1.8gb], real usage: [1972833976/1.8gb], new bytes reserved: [1110/1kb]]; ], allocation_status[no_attempt]]]"
                }
            ],
            "node_decision": "no",
            "node_id": "1XEXS92jTK-asdfasdfasdf",
            "node_name": "elasticsearch-data-2",
            "transport_address": "IP1:9300"
        },
        {
            "deciders": [
                {
                    "decider": "max_retry",
                    "decision": "NO",
                    "explanation": "shard has exceeded the maximum number of retries [5] on failed allocation attempts - manually call [/_cluster/reroute?retry_failed=true] to retry, [unassigned_info[[reason=ALLOCATION_FAILED], at[2020-10-30T06:10:16.305Z], failed_attempts[5], delayed=false, details[failed shard on node [o_9jyrmOSca9T12J4bY0Nw]: failed recovery, failure RecoveryFailedException[[docs_0_1603929645264][0]: Recovery failed from {elasticsearch-data-1}{fIaSuZsNTwODgZnt90f7kQ}{Qxl9iPacQVS-tN_t4YJqrw}{IP1}{IP1:9300} into {elasticsearch-data-0}{o_9jyrmOSca9T12J4bY0Nw}{1w5mgwy0RYqBQ9c-qA_6Hw}{IP2}{IP2:9300}]; nested: RemoteTransportException[[elasticsearch-data-1][IP1:9300][internal:index/shard/recovery/start_recovery]]; nested: RecoveryEngineException[Phase[1] phase1 failed]; nested: RecoverFilesRecoveryException[Failed to transfer [129] files with total size of [4.4gb]]; nested: RemoteTransportException[[elasticsearch-data-0][IP2:9300][internal:index/shard/recovery/file_chunk]]; nested: 
CircuitBreakingException[[parent] Data too large, data for [<transport_request>] would be [1972835086/1.8gb], which is larger than the limit of [1972122419/1.8gb], real usage: [1972833976/1.8gb], new bytes reserved: [1110/1kb]]; ], allocation_status[no_attempt]]]"
                },
                {
                    "decider": "same_shard",
                    "decision": "NO",
                    "explanation": "the shard cannot be allocated to the same node on which a copy of the shard already exists [[docs_0_1603929645264][0], node[fIaSuZsNTwODgZnt90f7kQ], [P], s[STARTED], a[id=stHnyqjLQ7OwFbaqs5vWqA]]"
                }
            ],
            "node_decision": "no",
            "node_id": "fIaSuZsNTwODgZnt90f7kQ",
            "node_name": "elasticsearch-data-1",
            "transport_address": "IP1:9300"
        },
        {
            "deciders": [
                {
                    "decider": "max_retry",
                    "decision": "NO",
                    "explanation": "shard has exceeded the maximum number of retries [5] on failed allocation attempts - manually call [/_cluster/reroute?retry_failed=true] to retry, [unassigned_info[[reason=ALLOCATION_FAILED], at[2020-10-30T06:10:16.305Z], failed_attempts[5], delayed=false, details[failed shard on node [o_9jyrmOSca9T12J4bY0Nw]: failed recovery, failure RecoveryFailedException[[docs_0_1603929645264][0]: Recovery failed from {elasticsearch-data-1}{fIaSuZsNTwODgZnt90f7kQ}{Qxl9iPacQVS-tN_t4YJqrw}{IP1}{IP1:9300} into {elasticsearch-data-0}{o_9jyrmOSca9T12J4bY0Nw}{1w5mgwy0RYqBQ9c-qA_6Hw}{Ip2}{IP2:9300}]; nested: RemoteTransportException[[elasticsearch-data-1][IP1:9300][internal:index/shard/recovery/start_recovery]]; nested: RecoveryEngineException[Phase[1] phase1 failed]; nested: RecoverFilesRecoveryException[Failed to transfer [129] files with total size of [4.4gb]]; nested: RemoteTransportException[[elasticsearch-data-0][IP2:9300][internal:index/shard/recovery/file_chunk]]; nested: 
CircuitBreakingException[[parent] Data too large, data for [<transport_request>] would be [1972835086/1.8gb], which is larger than the limit of [1972122419/1.8gb], real usage: [1972833976/1.8gb], new bytes reserved: [1110/1kb]]; ], allocation_status[no_attempt]]]"
                }
            ],
            "node_decision": "no",
            "node_id": "o_9jyrmOSca9T12J4bY0Nw",
            "node_name": "elasticsearch-data-0",
            "transport_address": "IP2:9300"
        }
    ],
    "primary": false,
    "shard": 0,
    "unassigned_info": {
        "at": "2020-10-30T06:10:16.305Z",
        "details": "failed shard on node [o_9jyrmOSca9T12J4bY0Nw]: failed recovery, failure RecoveryFailedException[[docs_0_1603929645264][0]: Recovery failed from {elasticsearch-data-1}{fIaSuZsNTwODgZnt90f7kQ}{Qxl9iPacQVS-tN_t4YJqrw}{IP1}{IP1:9300} into {elasticsearch-data-0}{o_9jyrmOSca9T12J4bY0Nw}{1w5mgwy0RYqBQ9c-qA_6Hw}{IP2}{IP2:9300}]; nested: RemoteTransportException[[elasticsearch-data-1][IP1:9300][internal:index/shard/recovery/start_recovery]]; nested: RecoveryEngineException[Phase[1] phase1 failed]; nested: RecoverFilesRecoveryException[Failed to transfer [129] files with total size of [4.4gb]]; nested: RemoteTransportException[[elasticsearch-data-0][IP2:9300][internal:index/shard/recovery/file_chunk]]; nested: 
CircuitBreakingException[[parent] Data too large, data for [<transport_request>] would be [1972835086/1.8gb], which is larger than the limit of [1972122419/1.8gb], real usage: [1972833976/1.8gb], new bytes reserved: [1110/1kb]]; ",
        "failed_allocation_attempts": 5,
        "last_allocation_status": "no_attempt",
        "reason": "ALLOCATION_FAILED"
    }
}

我查询了断路器配置

    curl -X GET "localhost:9200/_nodes/stats/breaker?pretty

可以看到3个节点(elasticsearch-data-0、elasticsearch-data-1和elasticsearch-data-2)的父limit_size_in_byes如下。

"parent" : {
          "limit_size_in_bytes" : 1972122419,
          "limit_size" : "1.8gb",
          "estimated_size_in_bytes" : 1648057776,
          "estimated_size" : "1.5gb",
          "overhead" : 1.0,
          "tripped" : 139
        }

我参考了这个答案https://stackoverflow.com/a/61954408 https://stackoverflow.com/a/61954408并计划增加断路器的内存百分比或整个 JVM 堆。

这是一个 k8s 环境,elasticsearch-data 部署为具有 3 个副本的有状态集。当我描述有状态集时,我可以看到定义了下面的 ENV 变量

Containers:
   elasticsearch:
    Image:      custom/elasticsearch-oss-s3:7.0.0
    Port:       9300/TCP
    Host Port:  0/TCP
    Limits:
      cpu:     10500m
      memory:  21Gi
    Requests:
      cpu:      10
      memory:   20Gi
    Environment:
      DISCOVERY_SERVICE:     elasticsearch-discovery
      NODE_MASTER:           false
      PROCESSORS:            11 (limits.cpu)
      ES_JAVA_OPTS:          -Djava.net.preferIPv4Stack=true -Xms2048m -Xmx2048m

据此,堆大小似乎是 2048m

我登录到了elasticsearch-data pod,在elasticsearch配置目录下我看到了下面的文件

elasticsearch.keystore  elasticsearch.yml  jvm.options  log4j2.properties  repository-s3

elasticsearch.yml 没有任何堆配置等。它只有主节点的名称等。

下面是 jvm.options 文件


## JVM configuration

# Xms represents the initial size of total heap space
# Xmx represents the maximum size of total heap space

-Xms1g
-Xmx1g


## GC configuration
-XX:+UseConcMarkSweepGC
-XX:CMSInitiatingOccupancyFraction=75
-XX:+UseCMSInitiatingOccupancyOnly


## DNS cache policy
-Des.networkaddress.cache.ttl=60
-Des.networkaddress.cache.negative.ttl=10


# pre-touch memory pages used by the JVM during initialization
-XX:+AlwaysPreTouch

## basic

# explicitly set the stack size
-Xss1m

# set to headless, just in case
-Djava.awt.headless=true

# ensure UTF-8 encoding by default (e.g. filenames)
-Dfile.encoding=UTF-8

# use our provided JNA always versus the system one
-Djna.nosys=true

# turn off a JDK optimization that throws away stack traces for common
# exceptions because stack traces are important for debugging
-XX:-OmitStackTraceInFastThrow


# flags to configure Netty
-Dio.netty.noUnsafe=true
-Dio.netty.noKeySetOptimization=true
-Dio.netty.recycler.maxCapacityPerThread=0

# log4j 2
-Dlog4j.shutdownHookEnabled=false
-Dlog4j2.disable.jmx=true

-Djava.io.tmpdir=${ES_TMPDIR}

## heap dumps

# generate a heap dump when an allocation from the Java heap fails
# heap dumps are created in the working directory of the JVM
-XX:+HeapDumpOnOutOfMemoryError

# specify an alternative path for heap dumps; ensure the directory exists and
# has sufficient space
-XX:HeapDumpPath=data

# specify an alternative path for JVM fatal error logs
-XX:ErrorFile=logs/hs_err_pid%p.log

## JDK 8 GC logging

8:-XX:+PrintGCDetails
8:-XX:+PrintGCDateStamps
8:-XX:+PrintTenuringDistribution
8:-XX:+PrintGCApplicationStoppedTime
8:-Xloggc:logs/gc.log
8:-XX:+UseGCLogFileRotation
8:-XX:NumberOfGCLogFiles=32
8:-XX:GCLogFileSize=64m

# JDK 9+ GC logging
9-:-Xlog:gc*,gc+age=trace,safepoint:file=logs/gc.log:utctime,pid,tags:filecount=32,filesize=64m
# due to internationalization enhancements in JDK 9 Elasticsearch need to set the provider to COMPAT otherwise
# time/date parsing will break in an incompatible way for some date patterns and locals
9-:-Djava.locale.providers=COMPAT

从上面看来,总堆大小为 1g。

但从这个pod的stateful set中定义的env变量来看,似乎是2048m。

哪一个是正确的?

现在,从下面的链接

断路器设置|弹性搜索 https://www.elastic.co/guide/en/elasticsearch/reference/current/circuit-breaker.html#parent-circuit-breaker

父级断路器可以配置以下设置:

index.breaker.total.use_real_memory (静态)确定父断路器是否应考虑实际内存使用情况 (true),还是仅考虑子断路器保留的内存量 (false)。默认为 true。

指数.breaker.total.limit (动态)总体父级断路器的起始限制。如果indices.breaker.total.use_real_memory 为 false,则默认为 JVM 堆的 70%。如果indices.breaker.total.use_real_memory为true,则默认为JVM堆的95%。

但我查询的错误和断路器统计信息中的极限值是 - 1972122419 字节(1.8G)。这好像不是2048M或者1g的95%。

现在,如何增加断路器父级的堆或内存限制,以便消除此错误?


这里有两件事,分片分配异常和断路器异常(看起来是嵌套异常)。

请在集群中使用以下命令重新触发分配,因为之前的所有重试都失败了,如果您仔细注意的话,异常消息中也会建议同样的操作。有关以下命令的更多信息在此相关Github问题评论 https://github.com/elastic/elasticsearch/issues/23199#issuecomment-280272888.

卷曲 -XPOST ':9200/_cluster/reroute?retry_failed

如果仍然不起作用,那么您必须修复父断路器异常,您应该使用http://localhost:9200/_nodes/statsAPI 可以了解您的 ES 节点的确切堆,并相应地增加它。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Elasticsearch 未分配分片 CircuitBreakingException[[parent] 数据太大 的相关文章

随机推荐

  • DSN 连接和带有 @ 的密码

    我考虑切换到使用 DSN 连接的数据库访问库 connect mysql login password database options DSN 使用 作为分隔符 这是否意味着密码不能包含 符号 还有其他限制吗 任何特殊字符对于 DSN 来
  • UIToolbar 的颜色没有改变

    我创建了一个 UIToolbar 我正在尝试使用以下方法将其变为黑色 toolbar barStyle UIBarStyleBlackOpaque or 工具栏background财产 但在任何一种情况下其颜色都不会改变 我怎样才能改变它
  • 在 OOP 中,什么是转发?它与委托有何不同?

    有人可以解释一下转发和委托之间的区别吗 它们看起来很相似 但我一直无法找到转发的良好定义 所以我不确定我是否真的理解 我们首先定义两个术语 sender the object that sends a message task to ano
  • 如何在execlp()之后找到程序的返回值? [复制]

    这个问题在这里已经有答案了 我在c中有以下代码 execlp ReturnValue c ReturnValue c应该返回0 3之间的整数 并且由于程序成功运行时execlp不会返回任何内容 那么如何获取该程序的返回值 你可以这样做 pi
  • 构建目录中的所有项目

    我尝试构建位于根目录的单独目录中的插件
  • 更改 blogdown 帖子的默认目录

    我正在使用的 Hugo 主题的帖子位于 content blog目录 而默认创建的新帖子blogdown new post is the content post目录 从函数定义来看 有一个全局选项可以更改新帖子保存到的目录 帮助也指出了这
  • IE 7、IE 8 等多选项卡浏览器会话问题

    由于会话对象 我对所有多选项卡浏览器都存在问题 我有一个要求 每当用户打开一个新浏览器时 我需要显示不同的值 所以我想到使用 Session 就像 IE 6 中每个浏览器都会创建一个新会话一样 但所有其他多选项卡浏览器 IE 7 和 IE
  • 如何从Thread获取返回值?

    我在用Thread for Webservice但我无法从中获取数据Thread因为我无法返回数据Thread 这是我的WebService java public class Webservice static String result
  • Java(桌面)应用程序的“自动更新”?

    您推荐什么系统来为某些 java 桌面 应用程序实现 自动更新 我还想安装和更新模块 插件 想想 Eclipse 和 Firefox 我知道 Eclipse RCP 的 OSGi 内容 NetBeans RCP 也有一些内容 是否必须完全购
  • 如何使用 IE7 Javascript 内存泄漏检测器?

    我下载了 SO 上其他地方提到的 IE 的 Javascript Memory Leak Detector 也在这里 http blogs msdn com askie archive 2008 12 31 javascript memor
  • Dynatree 展开所选节点的父级

    我的页面上运行良好的 Dynatree 我正在使用 initAjax 来获取结构 当我生成 json 时 我包含 选择 真在适当的地方选择复选框 大多数 所有 复选框都位于从根向下三层的深度 我想展开所选节点的父级 以便用户在页面加载时可以
  • 在网页中嵌入 Powerpoint

    有没有办法仅使用标准标签等将 PowerPoint 幻灯片嵌入到 HTML 页面中 我尝试使用 iframe 但这只会导致 PowerPoint 被下载 Your browser does not support 我正在寻找一种仅使用标准内
  • Rails simple_nested_form_for fields_for 参数数量错误

    所以我正在 Rails 3 1 中构建一个表单 使用 但部分中的这一行导致了问题 h2 Badges h2 ul this following line is raising the error wrong number of argume
  • Heroku 上的 Ruby 守护进程

    我正在尝试执行 ruby 守护进程无框架Heroku 上的应用程序 但在尝试执行工作程序后崩溃 heroku worker 1 State changed from crashed to starting heroku worker 1 S
  • Java-允许一个线程更新值,其他线程等待并跳过关键部分

    您好 我遇到一种情况 我必须只允许一个线程更新变量 有一个触发器 它可能会调用多个线程来更新此变量 但是更新应该仅由到达关键部分的第一个线程发生一次 理想情况下 流程应如下所示 线程1 调用 Thread 2 和 Thread 3 来更新由
  • 尽管缓存目录中存在文件,但 UIImage(contentsOfFile:) 返回 nil [重复]

    这个问题在这里已经有答案了 我正在尝试将带有叠加层的地图快照保存在缓存目录中 并在存在时检索它 然而 尽管创建了文件 但当我尝试检索它时 UIImage contentsOfFile 返回 nil 我已经打印了写入和读取的文件路径 它们是相
  • Qt/C++:程序在 Windows 操作系统下运行时图标不显示

    我使用的是QT 4 7 0 我在 Windows 中创建了一个项目 我在按钮上使用了一些图标 但是当我将 exe 文件移动到另一台 Windows 计算机时 图标不显示 如果我在开发计算机上运行该程序 则会出现图标 我创建了一个 qrc 文
  • 如何将续集日志写入文件而不是控制台?

    我想将续集日志写入文件而不是控制台 默认情况下 所有续集日志都会写入控制台 提前致谢 查看options logging in the docs http sequelize readthedocs io en latest api seq
  • 用于从代码视图切换到编辑器的 Summernote 事件

    我使用 google caja html sanitizer 来防止客户端执行脚本 所以我需要将事件放在从代码视图到编辑器的切换上 在这种情况下我会清理 html 由于该开关没有任何事件 我写了这样的内容 newFeaturesView n
  • Elasticsearch 未分配分片 CircuitBreakingException[[parent] 数据太大

    我收到警报 指出 elasticsearch 有 2 个未分配的分片 我进行了以下 api 调用以收集更多详细信息 curl s http localhost 9200 cluster allocation explain python m