1. window下启动kafka命令
C:\soft\kafka_2.11-0.11.0.0>.\bin\windows\kafka-server-start.bat .\config\server.properties
2. 启动报“另一个程序正在使用此文件,进程无法访问”问题
FATAL [Kafka Server 0], Fatal error during KafkaServer startup. Prepare to shutdown (kafka.server.KafkaServer)
java.nio.file.FileSystemException: \tmp\kafka-logs\test-0\00000000000000000000.timeindex: 另一个程序正在使用此文件,进程无法访问。
解决方法:删除logs目录下所有文件、重启zookeeper、重启kafka
3. linux后台方式启动zookeeper
cd /usr/local/kafka_2.11-1.0.1/
bin/zookeeper-server-start.sh -daemon config/zookeeper.properties &
4. linux后台方式启动kafka
cd /usr/local/kafka_2.11-1.0.1/bin
./kafka-server-start.sh -daemon ../config/server.properties &
5. kafka指定jdk,按以下方式修改bin目录下的kafka-server-start.sh
# Which java to use
if [ -z "$JAVA_HOME" ]; then
JAVA="java"
else
JAVA="/usr/local/java/jdk1.8.0_161/bin/java"
fi
6. 清除zookeeper中topic
登录zookieeper
./zookeeper-shell.sh 127.0.0.1:2181
查看topic
ls /brokers/topics
删除topic
rmr /brokers/topics/{topic_name}