[root@hadoop01 .sh]# ./kafka.sh
./kafka.sh: line 2: syntax error near unexpected token `;'
./kafka.sh: line 2: `ssh root@hadoop02 /bigdata/kafka/bin/kafka-server-start.sh config/server.properties &;ssh root@hadoop03 /bigdata/kafka/bin/kafka-server-start.sh config
/server.properties &'[root@hadoop01 .sh]# Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000680000000, 5368709120, 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 5368709120 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /.sh/hs_err_pid3296.log
参看日志hs_err_pid3296.log 发现主要原因:
本人安装kafka2.10-0.10.0.0版本,
启动脚本kafka-server-start.sh中指定了kafka启动时需要的最小内存,
默认为5G,配置如下:
export KAFKA_HEAP_OPTS="-Xm5G -Xms5G"
虚拟机分配的虚拟内存在2G时就会出现该错误
解决:
vi /home/kafka/bin/kafka-server-start.sh
将export KAFKA_HEAP_OPTS="-Xmx5G -Xms5G"
改为export KAFKA_HEAP_OPTS="-Xmx256M -Xms128M"