我在不同的服务器上运行Kafka和Kafka连接(假设服务器A和服务器B(
卡夫卡连接的服务器A
# vi /home/kafka/config/connect-distributed.properties
bootstrap.servers=serverB:9092
rest.host.name=localhost
rest.port=8083
卡夫卡的服务器B
# vi server.properties
broker.id=1
listeners=PLAINTEXT://:9092
advertised.listeners=PLAINTEXT://serverA:9092
delete.topic.enable = true
但是,当我在服务器A上运行kafka连接时,我遇到了一个错误。
[2020-04-30 16:59:37,053] ERROR Stopping due to error (org.apache.kafka.connect.cli.ConnectDistributed:84)
org.apache.kafka.connect.errors.ConnectException: Failed to connect to and describe Kafka cluster. Check worker's broker connection and security properties.
at org.apache.kafka.connect.util.ConnectUtils.lookupKafkaClusterId(ConnectUtils.java:64)
at org.apache.kafka.connect.util.ConnectUtils.lookupKafkaClusterId(ConnectUtils.java:45)
at org.apache.kafka.connect.cli.ConnectDistributed.startConnect(ConnectDistributed.java:95)
at org.apache.kafka.connect.cli.ConnectDistributed.main(ConnectDistributed.java:78)
Caused by: java.util.concurrent.ExecutionException: org.apache.kafka.common.errors.TimeoutException: Call(callName=listNodes, deadlineMs=1588233577048) timed out at 1588233577049 after 1 attempt(s)
at org.apache.kafka.common.internals.KafkaFutureImpl.wrapAndThrow(KafkaFutureImpl.java:45)
at org.apache.kafka.common.internals.KafkaFutureImpl.access$000(KafkaFutureImpl.java:32)
at org.apache.kafka.common.internals.KafkaFutureImpl$SingleWaiter.await(KafkaFutureImpl.java:89)
at org.apache.kafka.common.internals.KafkaFutureImpl.get(KafkaFutureImpl.java:260)
at org.apache.kafka.connect.util.ConnectUtils.lookupKafkaClusterId(ConnectUtils.java:58)
... 3 more
Caused by: org.apache.kafka.common.errors.TimeoutException: Call(callName=listNodes, deadlineMs=1588233577048) timed out at 1588233577049 after 1 attempt(s)
Caused by: org.apache.kafka.common.errors.TimeoutException: Timed out waiting for a node assignment.
仅供参考,如果我在卡夫卡服务器(服务器B(上运行卡夫卡连接,它就工作了。但是,我想在不同的服务器上运行这些。
如何连接kafka连接到kafka?
在server.properties
中,您有
advertised.listeners=PLAINTEXT://serverA:9092
但是Kafka连接使用
bootstrap.servers=serverB:9092
而不是
bootstrap.servers=serverA:9092