环境说明

使用了腾讯云的免费试用的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文件:
在这里插入图片描述
重启执行启动命令即可。

Logo

Kafka开源项目指南提供详尽教程,助开发者掌握其架构、配置和使用,实现高效数据流管理和实时处理。它高性能、可扩展,适合日志收集和实时数据处理,通过持久化保障数据安全,是企业大数据生态系统的核心。

更多推荐