Kafka启动,显示内存不足,修改内存项

时间:2022-03-14 16:48:02

转载自:http://www.4byte.cn/question/90076/kafka-8-and-memory-there-is-insufficient-memory-for-the-java-runtime-environment-to-continue.html

上面是原文,下面是网友的翻译,翻译措辞不准确,可以直接看英文。

问题 (Question)

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)

我用digiocean实例512兆字节的内存,我得到下面的错误与卡夫卡。我不精通Java开发如何调整量,利用小卡夫卡。这是一个开发服务器。我想交更多的每小时为一个更大的机器。

#
# 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)

最佳答案 (Best Answer)

You can adjust the JVM heap size by editing kafka-server-start.shzookeeper-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.

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

export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"

-Xms参数指定的最小堆大小。让你的服务器至少开始,试着改变它使用较少的内存。因为你只有512M,你应该改变最大堆大小(-Xmx)太:

export KAFKA_HEAP_OPTS="-Xmx256M -Xms128M"

我不知道是什么的最小内存要求卡夫卡在默认的配置文件是你可能需要调整的消息的大小在卡夫卡得到它运行。


问题 (Question)

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)

我用digiocean实例512兆字节的内存,我得到下面的错误与卡夫卡。我不精通Java开发如何调整量,利用小卡夫卡。这是一个开发服务器。我想交更多的每小时为一个更大的机器。

#
# 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)

最佳答案 (Best Answer)

You can adjust the JVM heap size by editing kafka-server-start.shzookeeper-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.

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

export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"

-Xms参数指定的最小堆大小。让你的服务器至少开始,试着改变它使用较少的内存。因为你只有512M,你应该改变最大堆大小(-Xmx)太:

export KAFKA_HEAP_OPTS="-Xmx256M -Xms128M"

我不知道是什么的最小内存要求卡夫卡在默认的配置文件是你可能需要调整的消息的大小在卡夫卡得到它运行。