[英]Does Spring Cloud Dataflow Local Server need to connect zookeeper?
I am trying to set up scdf on docker containers. 我正在尝试在docker容器上设置scdf。
All the containers are in one network 所有容器都在一个网络中
The two kafka s are exposed by port 2181 两个kafka通过2181端口暴露
and I am sure the kafka s are connecting to the zookeeper s. 而且我确定kafka已连接到zookeeper 。 (if not, they will not be started normally)
(否则,它们将无法正常启动)
But during the creation of the simple stream 但是在创建简单流的过程中
stream create --name test --definition "time | log" --deploy
I got these logs in the stdout_0.log
file which stands for the log
app logs. 我在
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]
in stderr_1.log
, I have 在
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
The first log said I am using localhost:0.0.0.0:2181
for zookeeper connection, which I am not, and I have configured the real IP address for kafka . 第一个日志说我正在使用
localhost:0.0.0.0:2181
进行Zookeeper连接,但不是,我已经配置了kafka的真实IP地址。
the second log said the timeout for connection is 10000 , which in kafka, I set the connection timeout to 6000 第二个日志说连接超时是10000 ,在kafka中,我将连接超时设置为6000
So these are not from kafka , then they are from scdf . 因此,这些不是来自kafka ,而是来自scdf 。
the fact is, when I look up the reference of scdf link , here it says, the zookeeper is not used ( or maybe not directly used ) in this architecture. 事实是,当我查找scdf link的引用时,它说,在此体系结构中没有使用( 或可能不直接使用 ) zookeeper 。
which confused me... if these logs not from kafka and not from scdf , then where does them from? 这让我感到困惑...如果这些日志不是来自kafka也不来自scdf ,那么它们从何而来?
If scdf does use zookeeper , then how to configure the connection for zookeeper ? 如果scdf确实使用zookeeper ,那么如何为zookeeper配置连接?
UPDATE UPDATE
I am thinking about when scdf is trying to create a topic , from what I know about creating a topic you have to specify the zookeeper connection, scdf uses localhost for producer s or consumer s to register on zookeeper , so scdf is actually using zookeeper somehow. 我正在考虑何时scdf尝试创建主题 ,根据我所知道的创建主题的知识,您必须指定zookeeper连接, scdf使用生产者或消费者的localhost在zookeeper上进行注册,因此scdf实际上以某种方式使用了zookeeper 。 but how to configure this?
但是如何配置呢?
OK, after a dig through the reference file. 确定,在浏览参考文件后。 I got this:
我懂了:
--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
Hope this will help the ones who are looking for the answer.... 希望这对正在寻找答案的人有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.