SQL 服务器连接失败 - Debezium - Kafka Connect

SQL Server Connection Failure - Debezium - Kafka Connect

我们正在尝试为 SQL-Server (mssql)

中的几个表设置 SQL-Server->Debezium->Kafka Connect->Kafka Pipeline

启动设置后,出现以下错误: 日志:

{
  "name": "mssql-server-uat",
  "connector": {
    "state": "RUNNING",
    "worker_id": "172.17.0.3:8083"
  },
  "tasks": [
    {
      "id": 0,
      "state": "FAILED",
      "worker_id": "172.17.0.3:8083",
      "trace": <separately given below>
    }
  ],
  "type": "source"
}

追踪:

org.apache.kafka.connect.errors.ConnectException: An exception occurred in the change event producer. This connector will be stopped.
    at io.debezium.pipeline.ErrorHandler.setProducerThrowable(ErrorHandler.java:42)
    at io.debezium.connector.sqlserver.SqlServerStreamingChangeEventSource.execute(SqlServerStreamingChangeEventSource.java:267)
    at io.debezium.pipeline.ChangeEventSourceCoordinator.lambda$start[=12=](ChangeEventSourceCoordinator.java:101)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
    at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: Connection timed out (Read failed)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2892)
    at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:2031)
    at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:6418)
    at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:7579)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:590)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:522)
    at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
    at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2935)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:248)
    at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:223)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:444)
    at io.debezium.jdbc.JdbcConnection.prepareQueryAndMap(JdbcConnection.java:657)
    at io.debezium.connector.sqlserver.SqlServerConnection.timestampOfLsn(SqlServerConnection.java:210)
    at io.debezium.connector.sqlserver.SqlServerStreamingChangeEventSource.lambda$execute(SqlServerStreamingChangeEventSource.java:243)
    at io.debezium.jdbc.JdbcConnection.prepareQuery(JdbcConnection.java:525)
    at io.debezium.connector.sqlserver.SqlServerConnection.getChangesForTables(SqlServerConnection.java:172)
    at io.debezium.connector.sqlserver.SqlServerStreamingChangeEventSource.execute(SqlServerStreamingChangeEventSource.java:162)
    ... 6 more
Caused by: java.net.SocketException: Connection timed out (Read failed)
    at java.base/java.net.SocketInputStream.socketRead0(Native Method)
    at java.base/java.net.SocketInputStream.socketRead(SocketInputStream.java:115)
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:168)
    at java.base/java.net.SocketInputStream.read(SocketInputStream.java:140)
    at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:2023)
    ... 21 more

可能的原因是什么?因为 sql-服务器已启动并且 运行 正常,这很奇怪

如果需要,请评论问题以获取任何特定信息

编辑:这个错误不会一直阻塞连接。启动时,连接正常,CDC事件流到Kafka,甚至被我们写的Kafka-Consumer读取,但突然超时,出现上述错误。

Kafka Connect 无法连接到您的 SQL 服务器。

SQLServerException: Connection timed out

可能的原因可能是:

  1. 您在连接器配置中指定了错误的主机名
  2. 您的网络不允许 Kafka Connect 连接到 SQL 服务器(例如,如果您正在使用 Docker 并且没有正确配置网络)
  3. 防火墙正在阻止到 SQL 服务器的入站流量

编辑:

  1. 如果错误是间歇性的,则表明可能 SQL 服务器本身正在超时,所以我会与您的 DBA 联系并请他们查看实例和机器 运行 查看是否有连接超时原因的指示。