org.postgresql.util.PSQLException:错误:语法错误



我正在尝试将debezium连接器postgres添加到我的Kafka Connect中。

首先,我通过验证了我的配置

看跌http://localhost:8083/connector-plugin/io.debezium.connecter.postgresql.PostgresConnector/config/validate

{
"name": "postgres-kafkaconnector",
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"tasks.max": "1",
"database.hostname": "example.com",
"database.port": "5432",
"database.dbname": "my_db",
"database.user": "xxx",
"database.password": "xxx",
"database.server.name": "my_db_server",
"table.include.list": "public.products",
"plugin.name": "pgoutput"
}

它返回的信息显示没有错误:

{
"name": "io.debezium.connector.postgresql.PostgresConnector",
"error_count": 0,
...

然后我尝试通过添加此连接器

岗位http://localhost:8083/connectors

{
"name": "postgres-kafkaconnector",
"config": {
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"tasks.max": "1",
"database.hostname": "example.com",
"database.port": "5432",
"database.dbname": "my_db",
"database.user": "xxx",
"database.password": "xxx",
"database.server.name": "my_db_server",
"table.include.list": "public.products",
"plugin.name": "pgoutput"
}
}

已成功添加连接器。

然而,我在运行时出错了

得到http://localhost:8083/connectors/postgres-kafka连接器/状态

ERROR WorkerSourceTask{id=postgres-kafkaconnector-0} Task threw an uncaught and unrecoverable exception (org.apache.kafka.connect.runtime.WorkerTask:179)
io.debezium.jdbc.JdbcConnectionException: ERROR: syntax error
at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.initPublication(PostgresReplicationConnection.java:180)
at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.createReplicationSlot(PostgresReplicationConnection.java:351)
at io.debezium.connector.postgresql.PostgresConnectorTask.start(PostgresConnectorTask.java:136)
at io.debezium.connector.common.BaseSourceTask.start(BaseSourceTask.java:130)
at org.apache.kafka.connect.runtime.WorkerSourceTask.execute(WorkerSourceTask.java:208)
at org.apache.kafka.connect.runtime.WorkerTask.doRun(WorkerTask.java:177)
at org.apache.kafka.connect.runtime.WorkerTask.run(WorkerTask.java:227)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2565)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2297)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:322)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:481)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:401)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:322)
at org.postgresql.jdbc.PgStatement.executeCachedSql(PgStatement.java:308)
at org.postgresql.jdbc.PgStatement.executeWithFlags(PgStatement.java:284)
at org.postgresql.jdbc.PgStatement.executeQuery(PgStatement.java:236)
at io.debezium.connector.postgresql.connection.PostgresReplicationConnection.initPublication(PostgresReplicationConnection.java:137)
... 11 more

我怎样才能看到完整的日志,尤其是11行以上的日志?我还查看了我的Kubernetes pod日志,它显示了相同的部分,但没有另外11行。

当前的错误内容不是很有用。如有任何进一步调试的帮助,我们将不胜感激!


更新1:

得到http://localhost:8083/connectors

返回

[
"postgres-kafkaconnector"
]

在使用Postgres 9.6.12之前,切换到Postgres 13.6之后。

使用相同的设置步骤,这次效果很好。

我的最佳猜测可能是因为我使用的debezium连接器postgres 1.8.1.Final版本不能很好地与旧的postgres 9.6.12配合使用。

最新更新