如何在分布式模式下运行Kafka连接复制器?



我想使用confluent的复制器将数据从一个系统复制到另一个系统。我正在使用两个 Ubuntu 18.04 系统,其中一个充当源,另一个充当目标。

我尝试在分布式模式下运行 kafka-connect-replicator,其中我更改了以下配置:

  1. 在 confluent/etc/kafka/server.properties 中,我进行了以下更改
SOURCE
> advertised.listeners=PLAINTEXT://source.ip:9092
DESTINATION
> advertised.listeners=PLAINTEXT://destination.ip:9092
  1. In confluent/etc/kafka-connect-replicator/replicator.connect.distributed.properties 我做了以下更改

- group.id=connect-replicator
group.id is same on source and destination system
SOURCE
- bootstrap.servers=destination.ip:9092, source.ip:9092
DESTINATION
- bootstrap.servers=destination.ip:9092, source.ip:9092
  1. In confluent/etc/kafka-connect-replicator/quickstart-replicator.properties 我更改了以下配置

name=replicator-source
connector.class=io.confluent.connect.replicator.ReplicatorSourceConnector
# source cluster connection info
src.kafka.bootstrap.servers=source.ip:9092
# Set to use direct connection to Zookeeper by Replicator on the source
src.zookeeper.connect=localhost:2181
# destination cluster connection info
dest.kafka.bootstrap.servers=destination.ip:9092
# Set to use direct connection to Zookeeper by Replicator on the destination
dest.zookeeper.connect=destination.ip:2181
# configure topics to replicate
topic.whitelist= test-topic
topic.rename.format=${topic}.replica

目的地

name=replicator-source
connector.class=io.confluent.connect.replicator.ReplicatorSourceConnector
# source cluster connection info
src.kafka.bootstrap.servers=source.ip:9092
# Set to use direct connection to Zookeeper by Replicator on the source
src.zookeeper.connect=source.ip:2181
# destination cluster connection info
dest.kafka.bootstrap.servers=destination.ip:9092
# Set to use direct connection to Zookeeper by Replicator on the destination
dest.zookeeper.connect=destination.ip:2181
# configure topics to replicate
topic.whitelist= test-topic
topic.rename.format=${topic}.replica

然后我在源系统中创建了主题并使用以下命令启动了连接器

PATH_TO_CONFLUENT> sudo ./bin/connect-distributed ./etc/kafka-connect-replicator/replicator-connect-distributed.properties ./etc/kafka-connect-replicator/quickstart-replicator.properties

在此之后,我从源系统在主题中生成数据,并尝试在主题名称为 {topic}.replica 的目标系统中使用,但没有主题可供使用。

目前尚不清楚您遇到了哪些错误,但有一些注意事项。

  1. connect-distributed只采用一个属性文件,而不是两个。将属性作为 JSON 以 JSON 形式 HTTP 发布到连接群集,而不是在群集启动期间加载属性文件。快速入门文件旨在用于connect-standalone

JSON 看起来像

{"name": "your-replicator-name", "config": {
"src.kafka.bootstrap.servers": "...",
...
}
  1. ./etc/kafka/connect-distributed.properties应该是在分布式模式下运行任何连接或复制器群集的起点,尽管replicator-connect-distributed.properties中可能有类似的配置

  2. bootstrap.servers应该只指向单个集群。源和目标将在src.kafka.bootstrap.serversdest.kafka.bootstrap.servers内分开

相关内容

  • 没有找到相关文章

最新更新