1

我正在尝试在 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:2181zookeeper连接,我不是,我已经为kafka配置了真实 IP 地址。

第二个日志说连接超时10000,在 kafka 中,我将连接超时设置为6000

所以这些不是来自kafka,而是来自scdf

事实是,当我查找scdf 链接的参考时,这里说,动物园管理员在这个架构中没有使用(或者可能没有直接使用)。

这让我感到困惑......如果这些日志不是来自kafka而不是来自scdf,那么它们来自哪里?

如果scdf确实使用zookeeper,那么如何配置zookeeper的连接?

更新

我正在考虑当scdf尝试创建主题时,根据我对创建主题的了解,您必须指定 zookeeper 连接,scdf使用localhost作为生产者消费者zookeeper上注册,因此scdf实际上以某种方式使用zookeeper . 但是如何配置呢?

4

1 回答 1

2

好的,经过参考文件的挖掘。我懂了:

--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

希望这对正在寻找答案的人有所帮助......

于 2016-12-14T05:21:36.113 回答