kafka启动报错Native memory allocation (mmap) failed to map 1073741824 bytes for

时间秒杀一切 提交于 2020-02-03 03:51:59

环境说明

使用了腾讯云的免费试用的1CPU/1GB服务器,通过bin/kafka-server-start.sh config/server.properties命令启动kafka服务,出现以下错误:

OpenJDK 64-Bit Server VM warning: If the number of processors is expected to increase from one, then you should configure the number of parallel GC threads appropriately using -XX:ParallelGCThreads=N
OpenJDK 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)
#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.
# An error report file with more information is saved as:

问题分析

kafka启用时默认要求分配1GB的内存,由于免费服务器性能限制,出现内存分配的异常

问题解决

修改kafka-server-start.sh文件:
在这里插入图片描述
重启执行启动命令即可。

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!