Debezium + kafka connect SASL实现sqlserver CDC

本文档详细介绍了如何配置Debezium和Kafka Connect,通过SASL_PLAINTEXT协议实现SQL Server的变更数据捕获(CDC)。在配置过程中,涉及到Kafka的SASL相关设置,包括producer和consumer的安全协议、JaAS配置,以及在SQL Server启用CDC的步骤。同时,文档中还提到了在使用过程中可能遇到的问题,例如时间类型转换、Kafka认证、时间精度模式等,并给出了相应的解决策略。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在项目中使用SASL_PLAINTEXT协议配置了用户名密码,启动connect的时候,一直报disconnect

启动的时候一直报错授权失败,或者是disconnected

需要在connect的配置文件connect-distributed.properties和插件的配置文件里同时添加相关的配置项

Kafka安装路径/kafka/config/connect-distributed.properties

# plugin.path=/usr/local/share/java,/usr/local/share/kafka/plugins,/opt/connectors,
plugin.path=

# 1.配置Connect workers去使用SASL/PLAIN
sasl.mechanism=PLAIN
# Configure SASL_SSL if SSL encryption is enabled, otherwise configure SASL_PLAINTEXT
security.protocol=SASL_SSL

# 2.配置JAAS参数,Connect的生产者和消费者去连接Kafka
sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
  username="connect" \
  password="connect-secret";
  
# 3.Source连接器配置相同的参数,加上producer前缀
producer.sasl.mechanism=PLAIN
# Configure SASL_SSL if SSL encryption is enabled, otherwise configure SASL_PLAINTEXT
producer.security.protocol=SASL_SSL
producer.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
  username="connect" \
  password="connect-secret";

# 4.Sink连接器配置相同的参数,加上consumer前缀
consumer.sasl.mechanism=PLAIN
# Configure SASL_SSL if SSL encryption is enabled, otherwise configure SASL_PLAINTEXT
consumer.security.protocol=SASL_SSL
consumer.sasl.jaas.config=org.apache.kafka.common.security.plain.PlainLoginModule required \
  username="connect" \
  password="connect-secret";

sqlserver-cdc-source.json

{
    "name": "sqlserver-cdc-source",
    "config": {
        "connector.class" : "io.debezium.connector.sqlserver.SqlServerConnector",
        "tasks.max" : "1",
        "database.server.name" : "db",
        "database.hostname" : "192.168.1

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值