我们正在使用Confluent MS SQL CDC连接器,连接描述符为:
curl -X POST -H \
"Content-Type: application/json" --data '{
"name" : "yury-mssql-cdc1",
"config" : {
"connector.class" : "io.confluent.connect.cdc.mssql.MsSqlSourceConnector",
"tasks.max" : "1",
"initial.database" : "test2",
"username" : "user",
"password" : "pass",
"server.name" : "some-server.eu-west-1.rds.amazonaws.com",
"server.port" : "1433",
"change.tracking.tables" : "dbo.foobar"
}
}' \
http://ip-10-0-0-24.eu-west-1.compute.internal:8083/connectors
整个基础架构都部署在AWS上...,但例外是:
查询ChangeKey时引发错误
{databaseName = test2,schemaName = dbo,tableName = foobar} (io.confluent.connect.cdc.mssql.QueryService:94) java.lang.NullPointerException:sourceOffset不能为null。
任何帮助将不胜感激。
答案 0 :(得分:1)
我找到了答案,我认为问题是配置SQL Server CDC的方式。我们不应该使用设置CDC的旧方法(EXEC sys.sp_cdc_enable_db和EXEC sys.sp_cdc_enable_table)
相反,使用以下命令来配置SQL Server CDC
ALTER DATABASE [数据库名称] SET CHANGE_TRACKING = ON(CHANGE_RETENTION = 2天,AUTO_CLEANUP = ON) 走 ALTER DATABASE [数据库名称]设置为ALLOW_SNAPSHOT_ISOLATION ON 走 ALTER TABLE [部分名称]启用CHANGE_TRACKING WITH(TRACK_COLUMNS_UPDATED = ON) 开始