kafka 8 和内存 - Java 运行时环境的内存不足,无法继续 [英] kafka 8 and memory - There is insufficient memory for the Java Runtime Environment to continue

查看:129
本文介绍了kafka 8 和内存 - Java 运行时环境的内存不足,无法继续的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用带有 512 兆内存的 DigiOcean 实例,我在使用 kafka 时遇到以下错误.我不是一个精通 Java 的开发人员.如何调整 kafka 以利用少量的 ram.这是一个开发服务器.我不想为更大的机器每小时支付更多费用.

<预><代码>## 没有足够的内存供 Java 运行时环境继续使用.# 本机内存分配 (malloc) 未能为提交保留内存分配 986513408 字节.# 包含更多信息的错误报告文件保存为:#//hs_err_pid6500.logOpenJDK 64 位服务器 VM 警告:信息:os::commit_memory(0x00000000bad30000, 986513408, 0) 失败;错误='无法分配内存' (errno=12)

解决方案

可以通过编辑kafka-server-start.shzookeeper-server-start来调整JVM堆大小.sh 等等:

导出 KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"

-Xms 参数指定最小堆大小.为了让您的服务器至少启动,请尝试更改它以使用更少的内存.鉴于您只有 512M,您也应该更改最大堆大小 (-Xmx):

导出 KAFKA_HEAP_OPTS="-Xmx256M -Xms128M"

我不确定默认配置中 kafka 的最低内存要求是多少 - 也许您需要调整 kafka 中的消息大小以使其运行.

I am using DigiOcean instance with 512 megs of ram, I get the below error with kafka. I am not a java proficient dev. How do I adjust kafka to utilize the small amount of ram. This is a dev sever. I dont want to pay more per hour for a bigger machine.

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 986513408 bytes for committing reserved memory.
# An error report file with more information is saved as:
# //hs_err_pid6500.log
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000bad30000, 986513408, 0) failed; error='Cannot allocate memory' (errno=12)

解决方案

You can adjust the JVM heap size by editing kafka-server-start.sh, zookeeper-server-start.shand so on:

export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"

The -Xms parameter specifies the minimum heap size. To get your server to at least start up, try changing it to use less memory. Given that you only have 512M, you should change the maximum heap size (-Xmx) too:

export KAFKA_HEAP_OPTS="-Xmx256M -Xms128M"

I'm not sure what the minimal memory requirements of kafka in default config are - maybe you need to adjust the message size in kafka to get it to run.

这篇关于kafka 8 和内存 - Java 运行时环境的内存不足,无法继续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆