我正在使用Spring-cloud-stream
来实现kafka。 Spring云属性是:
spring.application.name=services
spring.stream.bindings.output.destination=testTopic
spring.stream.bindings.output.content-type=application/json
spring.stream.bindings.kafka.binder.zkNodes=localhost
spring.stream.bindings.kafka.binder.brokers=localhost
但是我得到了一个错误,即zookeeper无法启动。
Unable to connect to zookeeper server within timeout: 10000
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:1223) ~[zkclient-0.7.jar:0.7]
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:155) ~[zkclient-0.7.jar:0.7]
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:129) ~[zkclient-0.7.jar:0.7]
at kafka.utils.ZkUtils$.createZkClientAndConnection(ZkUtils.scala:89) ~[kafka_2.11-0.9.0.1.jar:na]
at kafka.utils.ZkUtils$.apply(ZkUtils.scala:71) ~[kafka_2.11-0.9.0.1.jar:na]
at kafka.utils.ZkUtils.apply(ZkUtils.scala) ~[kafka_2.11-0.9.0.1.jar:na]
at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.createTopicAndPartitions(KafkaMessageChannelBinder.java:438)
然后在笔记本电脑上安装了zookeeper并启动它。但现在我又收到了另一个错误:
Failed to start bean 'outputBindingLifecycle'; nested exception is org.I0Itec.zkclient.exception.ZkNoNodeException: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /brokers/ids
Caused by: org.apache.zookeeper.KeeperException$NoNodeException: KeeperErrorCode = NoNode for /brokers/ids
at org.apache.zookeeper.KeeperException.create(KeeperException.java:111) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.zookeeper.KeeperException.create(KeeperException.java:51) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
at org.apache.zookeeper.ZooKeeper.getChildren(ZooKeeper.java:1472) ~[zookeeper-3.4.6.jar:3.4.6-1569965]
Spring Boot版本:1.4.4 Spring Cloud版本:Camden.SR5
这里有什么问题?