kafka报内存不足,导致节点无法成功启动(已解决)
查看日志:可能原因:# Possible reasons:#The system is out of physical RAM or swap space#In 32 bit mode, the process size limit was hit可能的解决方案:# Possible solutions:#Reduce memory load on the sy...
·
查看日志:
可能原因:
# Possible reasons:
# The system is out of physical RAM or swap space
# In 32 bit mode, the process size limit was hit
可能的解决方案:
# Possible solutions:
# Reduce memory load on the system
# Increase physical memory or swap space
# Check if swap backing store is full
# Use 64 bit Java on a 64 bit OS
# Decrease Java heap size (-Xmx/-Xms)
# Decrease number of Java threads
# Decrease Java thread stack sizes (-Xss)
# Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
# Out of Memory Error (os_linux.cpp:2756), pid=17968, tid=140647024301824
#
虚拟机参数:内存情况等
VM Arguments:
jvm_args: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager -Djava.security.egd=file:/dev/./urandom -Xms256m -Xmx512m -Dfile.encoding=UTF-8 -Djdk.tls.ephemeralDHKeySize=2048 -Dignore.endorsed.dirs= -Dcatalina.base=/usr/local/tomcat -Dcatalina.home=/usr/local/tomcat -Djava.io.tmpdir=/usr/local/tomcat/temp
java_command: org.apache.catalina.startup.Bootstrap stop
Launcher Type: SUN_STANDARD
解决方案:
vi /kafka_2.12-2.3.0/bin/kafka-server-start.sh
if [ "x$KAFKA_HEAP_OPTS" = "x" ]; then
export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G"
fi
启动内存设置的是1G,而我的机器最大只有2G内存,还启动了zk,mysql等,所以内存肯定是支持不了启动两个kafka的
所以在这里吧 1G 修改为 128M 或者 256M 即可。
注:改的太小的话,启动也会报错。
[ FATAL ] Fatal error during KafkaServerStable startup. Prepare to shutdown
java.lang.OutOfMemoryError: Java heap space
at java.nio.HeapByteBuffer.(HeapByteBuffer.java:57)
at java.nio.ByteBuffer.allocate(ByteBuffer.java:335)
at kafka.log.SkimpyOffsetMap.(OffsetMap.scala:42)
..........
这时候把上述配置的内存再改大一些就好了,比如 改为256M或者512M
更多推荐
已为社区贡献6条内容
所有评论(0)