kafka报内存不足:There is insufficient memory for the Java Runtime Environment to continue
在本机部署伪分布式kafka,第一个实例起来了,但是第二个实例启动不起来[root@VM_0_2_centos kafka]# jps27920 Jps24644 QuorumPeerMain24454 QuorumPeerMain27085 Kafka24589 QuorumPeerMainjps查询一直都只能查询到一个实例。找启动日志发现:[root@VM_0_2_centos k...
·
在本机部署伪分布式kafka,第一个实例起来了,但是第二个实例启动不起来
[root@VM_0_2_centos kafka]# jps
27920 Jps
24644 QuorumPeerMain
24454 QuorumPeerMain
27085 Kafka
24589 QuorumPeerMain
jps查询一直都只能查询到一个实例。
找启动日志发现:
[root@VM_0_2_centos kafka]# more hs_err_pid27561.log
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# 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=................
百度翻译了一下,大致意思是内存不足。
差了一下自己服务器:
发现kafka启动其实也只用了300多M内存,按理来说是足够的。
后来查资料发现,是启动参数的问题,在启动命令 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 即可。
注:改的太小的话,启动也会报错见:Kafka内存溢出错误
更多推荐
已为社区贡献2条内容
所有评论(0)