![](/img/trans.png)
[英]How to reference local Kafka and Zookeeper config on Spring Cloud Dataflow “Cloudfoundry” server start
[英]Does Spring Cloud Dataflow Local Server need to connect zookeeper?
我正在尝试在docker容器上设置scdf。
所有容器都在一个网络中
两个kafka通过2181端口暴露
而且我确定kafka已连接到zookeeper 。 (否则,它们将无法正常启动)
但是在创建简单流的过程中
stream create --name test --definition "time | log" --deploy
我在stdout_0.log
文件中获得了这些日志,该文件代表log
应用程序日志。
2016-12-14 01:18:03.264 INFO 62 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Opening socket connection to server localhost/0:0:0:0:0:0:0:1:2181. Will not attempt to authenticate using SASL (unknown error)
2016-12-14 01:18:03.265 WARN 62 --- [localhost:2181)] org.apache.zookeeper.ClientCnxn : Session 0x0 for server null, unexpected error, closing socket connection and attempting reconnect
java.net.ConnectException: Connection refused
at sun.nio.ch.SocketChannelImpl.checkConnect(Native Method) ~[na:1.8.0_111-internal]
at sun.nio.ch.SocketChannelImpl.finishConnect(SocketChannelImpl.java:717) ~[na:1.8.0_111-internal]
at org.apache.zookeeper.ClientCnxnSocketNIO.doTransport(ClientCnxnSocketNIO.java:361) ~[zookeeper-3.4.6.jar!/:3.4.6-1569965]
at org.apache.zookeeper.ClientCnxn$SendThread.run(ClientCnxn.java:1081) ~[zookeeper-3.4.6.jar!/:3.4.6-1569965]
在stderr_1.log
,我有
Caused by: org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 10000
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:880)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:98)
at org.I0Itec.zkclient.ZkClient.<init>(ZkClient.java:84)
at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.ensureTopicCreated(KafkaMessageChannelBinder.java:354)
at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.createKafkaConsumer(KafkaMessageChannelBinder.java:441)
at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.doBindConsumer(KafkaMessageChannelBinder.java:282)
at org.springframework.cloud.stream.binder.kafka.KafkaMessageChannelBinder.doBindConsumer(KafkaMessageChannelBinder.java:121)
at org.springframework.cloud.stream.binder.AbstractBinder.bindConsumer(AbstractBinder.java:177)
at org.springframework.cloud.stream.binding.ChannelBindingService.bindConsumer(ChannelBindingService.java:93)
at org.springframework.cloud.stream.binding.BindableProxyFactory.bindInputs(BindableProxyFactory.java:189)
at org.springframework.cloud.stream.binding.InputBindingLifecycle.start(InputBindingLifecycle.java:55)
at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:173)
... 27 more
第一个日志说我正在使用localhost:0.0.0.0:2181
进行Zookeeper连接,但不是,我已经配置了kafka的真实IP地址。
第二个日志说连接超时是10000 ,在kafka中,我将连接超时设置为6000
因此,这些不是来自kafka ,而是来自scdf 。
事实是,当我查找scdf link的引用时,它说,在此体系结构中没有使用( 或可能不直接使用 ) zookeeper 。
这让我感到困惑...如果这些日志不是来自kafka也不来自scdf ,那么它们从何而来?
如果scdf确实使用zookeeper ,那么如何为zookeeper配置连接?
UPDATE
我正在考虑何时scdf尝试创建主题 ,根据我所知道的创建主题的知识,您必须指定zookeeper连接, scdf使用生产者或消费者的localhost在zookeeper上进行注册,因此scdf实际上以某种方式使用了zookeeper 。 但是如何配置呢?
确定,在浏览参考文件后。 我懂了:
--spring.cloud.dataflow.applicationProperties.stream.spring.cloud.stream.kafka.binder.brokers=192.168.1.100:9092
--spring.cloud.dataflow.applicationProperties.stream.spring.cloud.stream.kafka.binder.zkNodes=192.168.1.100:2181
希望这对正在寻找答案的人有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.