未创建 Kafka 主题(ZooKeeperClientTimeoutException)
Kafka topic is not created (ZooKeeperClientTimeoutException)
我在我的 Linux 架子上打开 Kafka 的包装,然后我做了:
启动动物园管理员:
./zookeeper-server-start.sh
输出:
USAGE: ./zookeeper-server-start.sh [-daemon] zookeeper.properties
启动kafka服务器
./kafka-server-start.sh
输出:
USAGE: ./kafka-server-start.sh [-daemon] server.properties [--override property=value]*
然后我尝试创建主题
./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic fss-fsstransdata
但出现异常
Exception in thread "main" kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
at kafka.zookeeper.ZooKeeperClient$$anonfun$kafka$zookeeper$ZooKeeperClient$$waitUntilConnected.apply$mcV$sp(ZooKeeperClient.scala:259)
at kafka.zookeeper.ZooKeeperClient$$anonfun$kafka$zookeeper$ZooKeeperClient$$waitUntilConnected.apply(ZooKeeperClient.scala:255)
at kafka.zookeeper.ZooKeeperClient$$anonfun$kafka$zookeeper$ZooKeeperClient$$waitUntilConnected.apply(ZooKeeperClient.scala:255)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:253)
at kafka.zookeeper.ZooKeeperClient.kafka$zookeeper$ZooKeeperClient$$waitUntilConnected(ZooKeeperClient.scala:255)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:113)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1857)
at kafka.admin.TopicCommand$ZookeeperTopicService$.apply(TopicCommand.scala:321)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:54)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
请帮忙解决这个问题
正如您从输出中看到的那样:
USAGE: ./zookeeper-server-start.sh [-daemon] zookeeper.properties
USAGE: ./kafka-server-start.sh [-daemon] server.properties [--override property=value]*
如果你想启动服务器,你需要指定那些properties
文件,这些文件在kafka home下的config
目录中。
所以要启动动物园管理员:
./zookeeper-server-start.sh ../config/zookeeper.properties
然后启动kafka-server
./kafka-server-start.sh ../config/server.properties
然后,尝试创建主题
我在我的 Linux 架子上打开 Kafka 的包装,然后我做了:
启动动物园管理员:
./zookeeper-server-start.sh
输出:
USAGE: ./zookeeper-server-start.sh [-daemon] zookeeper.properties
启动kafka服务器
./kafka-server-start.sh
输出:
USAGE: ./kafka-server-start.sh [-daemon] server.properties [--override property=value]*
然后我尝试创建主题
./kafka-topics.sh --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 --topic fss-fsstransdata
但出现异常
Exception in thread "main" kafka.zookeeper.ZooKeeperClientTimeoutException: Timed out waiting for connection while in state: CONNECTING
at kafka.zookeeper.ZooKeeperClient$$anonfun$kafka$zookeeper$ZooKeeperClient$$waitUntilConnected.apply$mcV$sp(ZooKeeperClient.scala:259)
at kafka.zookeeper.ZooKeeperClient$$anonfun$kafka$zookeeper$ZooKeeperClient$$waitUntilConnected.apply(ZooKeeperClient.scala:255)
at kafka.zookeeper.ZooKeeperClient$$anonfun$kafka$zookeeper$ZooKeeperClient$$waitUntilConnected.apply(ZooKeeperClient.scala:255)
at kafka.utils.CoreUtils$.inLock(CoreUtils.scala:253)
at kafka.zookeeper.ZooKeeperClient.kafka$zookeeper$ZooKeeperClient$$waitUntilConnected(ZooKeeperClient.scala:255)
at kafka.zookeeper.ZooKeeperClient.<init>(ZooKeeperClient.scala:113)
at kafka.zk.KafkaZkClient$.apply(KafkaZkClient.scala:1857)
at kafka.admin.TopicCommand$ZookeeperTopicService$.apply(TopicCommand.scala:321)
at kafka.admin.TopicCommand$.main(TopicCommand.scala:54)
at kafka.admin.TopicCommand.main(TopicCommand.scala)
请帮忙解决这个问题
正如您从输出中看到的那样:
USAGE: ./zookeeper-server-start.sh [-daemon] zookeeper.properties
USAGE: ./kafka-server-start.sh [-daemon] server.properties [--override property=value]*
如果你想启动服务器,你需要指定那些properties
文件,这些文件在kafka home下的config
目录中。
所以要启动动物园管理员:
./zookeeper-server-start.sh ../config/zookeeper.properties
然后启动kafka-server
./kafka-server-start.sh ../config/server.properties
然后,尝试创建主题