跟着卡夫卡官网走 QuickStart 教程,遇到了不少问题,现记录如下:
第一步
?第一步没有问题。
?第二步
这里第一次可以成功,如果关掉虚拟机重开后,重试这一步会报错,报错信息如下:
[2020-01-11 11:12:43,783] ERROR Unexpected exception, exiting abnormally (org.apache.zookeeper.server.ZooKeeperServerMain)
java.io.IOException: No snapshot found, but there are log entries. Something is broken!
at org.apache.zookeeper.server.persistence.FileTxnSnapLog.restore(FileTxnSnapLog.java:222)
at org.apache.zookeeper.server.ZKDatabase.loadDataBase(ZKDatabase.java:240)
at org.apache.zookeeper.server.ZooKeeperServer.loadData(ZooKeeperServer.java:290)
at org.apache.zookeeper.server.ZooKeeperServer.startdata(ZooKeeperServer.java:450)
at org.apache.zookeeper.server.NIOServerCnxnFactory.startup(NIOServerCnxnFactory.java:764)
at org.apache.zookeeper.server.ServerCnxnFactory.startup(ServerCnxnFactory.java:98)
at org.apache.zookeeper.server.ZooKeeperServerMain.runFromConfig(ZooKeeperServerMain.java:144)
at org.apache.zookeeper.server.ZooKeeperServerMain.initializeAndRun(ZooKeeperServerMain.java:106)
at org.apache.zookeeper.server.ZooKeeperServerMain.main(ZooKeeperServerMain.java:64)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.initializeAndRun(QuorumPeerMain.java:128)
at org.apache.zookeeper.server.quorum.QuorumPeerMain.main(QuorumPeerMain.java:82)
在linux环境下 / 目录,把这个里面的东西全删了,就可以正常再次启动 zookeeper 了
rm -rf /tmp/zookeeper/*
第三步
?这里的第一个命令会执行错误,报错如下:
Missing required argument "[partitions]"
所以我们在命令里添加下述两个参数
--partitions 1 --replication-factor 1
新的命令如下:
bin/kafka-topics.sh --create --topic quickstart-events --bootstrap-server localhost:9092 --partitions 1 --replication-factor 1
执行成功后会出现如下提示:
Created topic quickstart-events.
第四步?
?
?
结束
?这个是删除旧有日志。和上面第二步我们做的还不一样
?
?
|