You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何提升Solr Cloud 8.4.0中内嵌ZooKeeper的大小限制

Docker中Solr内嵌ZooKeeper的Jute MaxBuffer配置不生效问题

错误信息

NIOServerCnxn Exception causing close of session 0x100015d298b0002: Len error 2248387

问题背景

  • 已在Solr启动参数中设置-Djute.maxbuffer=536870912(512MB),但仍触发ZooKeeper数据包大小限制错误
  • ZooKeeper默认jute.maxbuffer限制为1MB,移除所有1MB以上的文件后Solr Cloud可正常运行
  • 使用的是Solr内嵌ZooKeeper(启动命令带-DzkRun参数)

当前启动命令

$ solr start -cloud -p 8984 -s "/opt/solr/example/cloud/node1/solr" -V
Using Solr root directory: /opt/solr
Using Java: /usr/local/openjdk-11/bin/java
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment 18.9 (build 11.0.6+10)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.6+10, mixed mode)
Configuring SolrCloud to launch an embedded Zookeeper using -DzkRun

Starting Solr using the following settings:
    JAVA            = /usr/local/openjdk-11/bin/java
    SOLR_SERVER_DIR = /opt/solr/server
    SOLR_HOME       = /opt/solr/example/cloud/node1/solr
    SOLR_HOST       = 
    SOLR_PORT       = 8984
    STOP_PORT       = 7984
    JAVA_MEM_OPTS   = -Xms2G -Xmx6G
    GC_TUNE         = -XX:+UseG1GC -XX:+PerfDisableSharedMem -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=250 -XX:+UseLargePages -XX:+AlwaysPreTouch
    GC_LOG_OPTS     = -Xlog:gc*:file=/opt/solr/example/cloud/node1/solr/../logs/solr_gc.log:time,uptime:filecount=9,filesize=20M
    SOLR_TIMEZONE   = UTC
    CLOUD_MODE_OPTS = -DzkClientTimeout=15000 -DzkRun
    SOLR_OPTS       = -Dsolr.environment=prod -Djute.maxbuffer=536870912 -Xss256k -Dsolr.jetty.https.port=8984


Warning: Available entropy is low. As a result, use of the UUIDField, SSL, or any other features that require
RNG might not work properly. To check for the amount of available entropy, use 'cat /proc/sys/kernel/random/entropy_avail'.

Waiting up to 180 seconds to see Solr running on port 8984 [/]  
Started Solr server on port 8984 (pid=2512). Happy searching!

问题原因

你只在SOLR_OPTS中设置了Solr客户端的jute.maxbuffer,但内嵌ZooKeeper服务端并未加载该参数。ZooKeeper要求客户端和服务端的jute.maxbuffer配置保持一致,且服务端值不能小于客户端,否则会触发数据包大小超限错误。

解决方案

方案1:修改启动命令,传递参数给内嵌ZK服务端

将-Djute.maxbuffer=536870912直接加到启动命令的ZK相关参数中,确保内嵌ZK服务端能读取到:

solr start -cloud -p 8984 -s "/opt/solr/example/cloud/node1/solr" -V -DzkRun -Djute.maxbuffer=536870912

方案2:通过Solr配置文件全局设置

在Solr的solr.in.sh(Linux/macOS)或solr.in.cmd(Windows)配置文件中添加以下内容,让内嵌ZK启动时自动加载该参数:

ZK_SERVER_OPTS="-Djute.maxbuffer=536870912"

方案3:Docker环境下的参数传递

如果是通过Docker容器运行,确保环境变量同时覆盖Solr客户端和ZK服务端的配置:

docker run -e SOLR_OPTS="-Djute.maxbuffer=536870912" -e ZK_SERVER_OPTS="-Djute.maxbuffer=536870912" [其他Solr容器参数]

验证方法

启动后,可以通过以下方式确认配置是否生效:

  1. 查看Solr进程的JVM参数,确认jute.maxbuffer已加载:
    ps aux | grep solr | grep jute.maxbuffer
    
  2. 使用ZooKeeper客户端连接内嵌ZK,查看服务端配置(适用于ZK 3.5+):
    ./zkCli.sh -server localhost:2181
    get /zookeeper/config
    
    输出中应包含jute.maxbuffer=536870912的配置项。

内容的提问来源于stack exchange,提问作者Ngọc Bình

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.07 08:24:54