系统版本:Ubuntu 4.8.2-19ubuntu1
安装kafka版本:0.9.0.1
wget http://archive.apache.org/dist/kafka/0.9.0.1/kafka_2.11-0.9.0.1.tgz
tar -zxvf kafka_2.11-0.9.0.1.tgz
#进入目录 cd kafka_2.11-0.9.0.1/ #修改启动脚本 vim bin/kafka-server-start.sh ==找到 export KAFKA_HEAP_OPTS="-Xmx1G -Xms1G" ==需要内存改小一点 export KAFKA_HEAP_OPTS="-Xmx256M -Xms128M" == #否则会报内存不足
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000bae00000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (malloc) failed to allocate 1073741824 bytes for committing reserved memory. # An error report file with more information is saved as: # /home/soft/kafka_2.11-0.9.0.1/hs_err_pid25902.log
#启动#注意要先启动zookeeper,并且如果不是2181默认端口要修改 sh bin/kafka-server-start.sh config/server.properties &
#kafka默认启动9092端口 telnet localhost 9092
sh bin/kafka-server-stop.sh