You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Docker环境下YugabyteDB Debezium CDC连接器注册失败求助

解决Debezium Connect注册YugabyteDB连接器超时问题

问题现象

  • Debezium Connect与YugabyteDB容器均正常启动,但注册连接器时返回500超时错误:{"error_code":500,"message":"Request timed out"}
  • Connect容器日志警告:WARN || Unable to find the leader master (127.0.0.1:7100), will retry [org.yb.client.GetMasterRegistrationReceived]
  • 已确认:Connect与Yugabyte容器同网络,DNS解析正常,可手动连接YugabyteDB创建库表,端口已绑定到0.0.0.0

核心原因

YugabyteDB启动时,--master_addresses和--tserver_master_addrs参数设置为0.0.0.0:7100,导致Master节点向客户端返回的自身地址为容器内部的127.0.0.1:7100。Debezium连接器从Connect容器发起请求时,会尝试连接自身容器的127.0.0.1而非YugabyteDB容器,最终超时失败。

解决方案

1. 修改YugabyteDB启动命令

更新Docker Compose中Yugabyte服务的command参数,将--master_addresses和--tserver_master_addrs改为容器服务名yugabyte:7100:

yugabyte:
  image: yugabytedb/yugabyte:2.25.2.0-b359
  platform: linux/amd64
  command: >
    bash -c "
      /home/yugabyte/bin/yb-master --fs_data_dirs=/mnt/disk0 --rpc_bind_addresses=0.0.0.0:7100 --webserver_interface=0.0.0.0 --webserver_port=9000 --master_addresses=yugabyte:7100 --replication_factor=1 & sleep 10 && /home/yugabyte/bin/yb-tserver --fs_data_dirs=/mnt/disk1 --start_pgsql_proxy --rpc_bind_addresses=0.0.0.0:9100 --webserver_interface=0.0.0.0 --webserver_port=7001 --tserver_master_addrs=yugabyte:7100 --pgsql_proxy_bind_address=0.0.0.0:5433 --pgsql_proxy_webserver_port=15433
    "
  # 其余端口、环境变量配置保持不变

2. 验证Master节点注册地址

重启Yugabyte容器后,通过以下命令确认Master节点的注册地址为服务名而非127.0.0.1:

docker exec -it <yb-container-name> curl http://localhost:9000/master-status

在返回的JSON中查找rpc_address字段,确认值为yugabyte:7100。

3. 重新注册连接器

删除原有失败的连接器(如果存在),重新提交配置:

curl -X DELETE http://localhost:8083/connectors/yugabyte-connector
curl -X POST -H "Content-Type: application/json" --data @source.json http://localhost:8083/connectors

额外检查项

  • 确认Debezium YugabyteDB gRPC连接器插件已放置在Connect容器的/kafka/custom-plugins目录下,且版本与Debezium Connect(2.5)兼容
  • 检查Connect容器的CONNECT_PLUGIN_PATH环境变量是否包含插件目录,确保连接器能被加载

内容的提问来源于stack exchange,提问作者RaRa

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.13 00:16:04