Zookeeper報錯 len4807928 is out of range!

來源:互聯網
上載者:User

因為某些誤操作,導致znode節點上的資料太大,超過長度,這時候要ls或者rmr就會報錯

大概像下圖:



Packet len4807928 is out of range

在外網有這樣的文章:

https://stackoverflow.com/questions/10249579/zookeeper-cli-failing-ioexception-packet-len12343123123-is-out-of-range


這是zookeeper的源碼:

707         void readLength() throws IOException {708             int len = incomingBuffer.getInt();709             if (len < 0 || len >= packetLen) {710                 throw new IOException("Packet len" + len + " is out of range!");711             }712             incomingBuffer = ByteBuffer.allocate(len);713         }

並且在外網的文章當中有解決方案:



7 down vote

I was able to work around this by increasing the max size of my listing call.

I added the "-Djute.maxbuffer=50111000" to my zkCli.sh script so that it started the client using the following line:

$JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \ "-Djute.maxbuffer=49107800" -cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS \ org.apache.zookeeper.ZooKeeperMain "$@"

I was then able to list & use rmr /big/node


說的是要在你的zkCli.sh裡面添加上

 "-Djute.maxbuffer=50111000"  這一行,相當於增加他的最大容量,然後再去刪除或者ls查看你的節點就可以了。

7 down vote

I was able to work around this by increasing the max size of my listing call.

I added the "-Djute.maxbuffer=50111000" to my zkCli.sh script so that it started the client using the following line:

$JAVA "-Dzookeeper.log.dir=${ZOO_LOG_DIR}" "-Dzookeeper.root.logger=${ZOO_LOG4J_PROP}" \ "-Djute.maxbuffer=49107800" -cp "$CLASSPATH" $CLIENT_JVMFLAGS $JVMFLAGS \ org.apache.zookeeper.ZooKeeperMain "$@"

I was then able to list & use rmr /big/node

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.