gpt4 book ai didi

distributed - 如何在分布式模式下部署kafka connect?

转载 作者:行者123 更新时间:2023-12-03 17:13:19 31 4
gpt4 key购买 nike

我正在使用 kubernetes 中的 JDBC sink 连接器构建 Kafka-connect 应用程序。我尝试了独立模式,它正在工作。我想转向分布式模式。
我可以通过运行下面的 yaml 文件成功构建两个 pod(kafka 连接器):

apiVersion: extensions/v1beta1
kind: Deployment
metadata:
namespace: vtq
name: kafka-sink-postgres-dis
spec:
replicas: 2
template:
metadata:
labels:
app: kafka-sink-postgres-dis
spec:
containers:
- name: kafka-sink-postgres-dis
image: ***
imagePullPolicy: Always

bin/connect-distributed.sh config/worker.properties
bootstrap.servers=***:9092
offset.flush.interval.ms=10000

rest.port=8083
rest.host.name=127.0.0.1


key.converter=org.apache.kafka.connect.storage.StringConverter
value.converter=io.confluent.connect.avro.AvroConverter
value.converter.schema.registry.url=http://schema-registry:8081


# Prevent the connector from pulling all historical messages
auto.offset.reset=latest

# options below may be required for distributed mode

# unique name for the cluster, used in forming the Connect cluster group. Note that this must not conflict with consumer group IDs
group.id=connect-postgres-sink-dis

# Topic to use for storing offsets. This topic should have many partitions and be replicated.
offset.storage.topic=postgres-connect-offsets
offset.storage.replication.factor=3

# Topic to use for storing connector and task configurations; note that this should be a single partition, highly replicated topic.
# You MUST manually create the topic to ensure single partition for the config topic as auto created topics may have multiple partitions.

config.storage.topic=postgres-connect-configs
config.storage.replication.factor=3

# Topic to use for storing statuses. This topic can have multiple partitions and should be replicated.
status.storage.topic=postgres-connect-status
status.storage.replication.factor=3

并使用 task.max=1 在每个 pod 内创建一个接收器连接器,两个连接器监听相同的主题。原来他们只是复制了。
curl -X POST -H "Content-Type: application/json" --data '{"name": "postgres_sink_dis", "config": {"connector.class":"io.confluent.connect.jdbc.JdbcSinkConnector", "tasks.max":"1", "connection.url":"***","topics":"***"}}' http://127.0.0.1:8083/connectors

但是我对 kafka 连接集群、工作人员、连接器和任务的概念感到非常困惑。我从
https://github.com/enfuse/kafka-connect-demo/blob/master/docs/install-connector.md .
他们在配置连接器之前设置端口转发到其余端口。我尝试过,在部署服务并创建连接器后, curl -s 172.0.0.1:8083/connectors 没有返回。

谁能给我一个简短的描述,我接下来应该做什么,任何相关信息都会非常有帮助。谢谢!

更新:
最后,我想通了问题并解决了问题。
1. 分别部署两个具有相同 group.id 和不同 rest.port ( https://docs.confluent.io/current/connect/userguide.html ) 的 pods/worker。
2. 在 pod 内,创建一个带有任务的连接器。

最佳答案

例如,您有一个由两个工作人员/两个 Pod 组成的连接器集群。您可以使用集群中的多个任务创建连接器( sink 或 source ),这些任务将分布在两个工作人员中。

关于distributed - 如何在分布式模式下部署kafka connect?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57699620/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com