一、Kafka的安装教程
详细的安装过程,请查看:https://www.cnblogs.com/luotianshuai/p/5206662.html
二、安装问题
1、在 Kafka目录 bin 下,启动 ./kafka-server-start.sh -daemon ../config/server.properties 出现:
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)
解决方法:在 kafka-server-start.sh 调整JVM内存配置 。如下所示:
export KAFKA_HEAP_OPTS="-Xmx512M -Xms512M"
若还报内存问题,继续调整:
export KAFKA_HEAP_OPTS="-Xmx256M -Xms128M"
2、启动 ./kafka-server-start.sh ,控制台输出:
host.name=118.31.8.21 出现: org.apache.kafka.common.KafkaException: Socket server failed to bind to 118.31.8.21:19092: 无法指定被请求的地址
host.name=0.0.0.0 出现:java.lang.IllegalArgumentException: requirement failed: advertised.listeners cannot use the nonroutable meta-address 0.0.0.0. Use a routable IP address.
因我这里是云服务器,解决方案: host.name=127.0.0.1