postgresql - 使用 debezium 链接 postgresql 11 无法获取数据库测试的编码
问题描述
我使用debezium cdc connect pg,我构建了docker使用的pg 11,pg运行良好。当我在 kafka 连接器中使用 debezium 时,它报告:</p>
无法获取数据库测试的编码
卷曲是:
curl -H "Accept: application/json" -H "Content-type: application/json" -X POST http://localhost:8083/connectors/ -d '{
"name": "debezium",
"config": {
"name": "debezium",
"connector.class": "io.debezium.connector.postgresql.PostgresConnector",
"tasks.max": "1",
"database.hostname": "localhost",
"database.port": "5432",
"database.dbname": "test",
"database.user": "pg",
"database.password": "135790",
"database.server.name": "ls",
"table.whitelist": "public.test",
"plugin.name": "pgoutput"
}
}'
卡夫卡例外是:
[2020-07-08 09:24:35,076] ERROR Uncaught exception in REST call to /connectors/ (org.apache.kafka.connect.runtime.rest.errors.ConnectExceptionMapper:61)
java.lang.RuntimeException: Couldn't obtain encoding for database test
at io.debezium.connector.postgresql.connection.PostgresConnection.determineDatabaseCharset(PostgresConnection.java:434)
at io.debezium.connector.postgresql.connection.PostgresConnection.<init>(PostgresConnection.java:77)
at io.debezium.connector.postgresql.connection.PostgresConnection.<init>(PostgresConnection.java:87)
at io.debezium.connector.postgresql.PostgresConnector.validate(PostgresConnector.java:102)
at org.apache.kafka.connect.runtime.AbstractHerder.validateConnectorConfig(AbstractHerder.java:277)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder$6.call(DistributedHerder.java:534)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder$6.call(DistributedHerder.java:531)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.tick(DistributedHerder.java:267)
at org.apache.kafka.connect.runtime.distributed.DistributedHerder.run(DistributedHerder.java:216)
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: FATAL: database "test" does not exist
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2532)
at org.postgresql.core.v3.QueryExecutorImpl.readStartupMessages(QueryExecutorImpl.java:2644)
at org.postgresql.core.v3.QueryExecutorImpl.<init>(QueryExecutorImpl.java:137)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:255)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:217)
at org.postgresql.Driver.makeConnection(Driver.java:458)
at org.postgresql.Driver.connect(Driver.java:260)
at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$1(JdbcConnection.java:190)
at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:788)
at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:783)
at io.debezium.connector.postgresql.connection.PostgresConnection.determineDatabaseCharset(PostgresConnection.java:431)
... 13 more
[2020-07-08 09:24:35,128] INFO 127.0.0.1 - - [08/Jul/2020:01:24:34 +0000] "POST /connectors/ HTTP/1.1" 500 73 330 (org.apache.kafka.connect.runtime.rest.RestServer:60)
解决方案
在我看来,名为的数据库test
要么不存在,要么用户不可见pg
。
推荐阅读
- c# - httpclient post 方法返回 StatusCode: 403, ReasonPhrase: 'Forbidden'
- tensorflow - 当我只对现有类的子类别感兴趣时重新训练模型
- javascript - 显示来自 shopify api (cart/add.js) 的响应描述
- javascript - 服务器和客户端类名不匹配
- javascript - ReactiveAggregate() + collection.update() -> Error: Expected to find a document to change
- razor - 我的新 CSProj 使用 SDK 格式,但 MVC Razor 视图针对的是 AspNetCore 而不是 AspNet
- json - 即使过程返回正确的值,数据集也没有值
- c# - 如何在 C# catch 块中获取异常代码
- c# - 诊断应用程序变慢和内存消耗(可能是 WCF 或 MongoDB C# 驱动程序)?
- javascript - 如何使用我的机器人修复此“附件不是构造函数”错误?