Kafka Connect Debezium postgres

时间:2018-06-14 00:00:09

标签: postgresql apache-kafka apache-kafka-connect debezium

我正在尝试使用Debezium将Amazon RDS中托管的Postgres SQL数据库与Kafka主题相关联。

我遵循以下教程:

http://debezium.io/docs/tutorial/

我的kafka和kafka连接服务启动正常,kafka连接服务也在/ usr / share / java目录中获取我的debezium postgres连接器jar。

但是在尝试使用以下curl命令通过kafka connect API附加postgres config json时:

curl -i -X POST -H "Accept:application/json" -H "Content-Type:application/json" localhost:8083/connectors/ -d @connector1.json  

我最终收到以下错误:

 [2018-06-13 23:45:44,749] ERROR Uncaught exception in REST call to /connectors/ (org.apache.kafka.connect.runtime.rest.errors.ConnectExceptionMapper:61)
org.apache.kafka.connect.errors.ConnectException: Could not intialize type registry
    at io.debezium.connector.postgresql.connection.PostgresConnection.<init>(PostgresConnection.java:68)
    at io.debezium.connector.postgresql.PostgresConnector.validate(PostgresConnector.java:95)
    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: The connection attempt failed.
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:275)
    at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
    at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:194)
    at org.postgresql.Driver.makeConnection(Driver.java:431)
    at org.postgresql.Driver.connect(Driver.java:247)
    at io.debezium.jdbc.JdbcConnection.lambda$patternBasedFactory$1(JdbcConnection.java:161)
    at io.debezium.jdbc.JdbcConnection.connection(JdbcConnection.java:585)
    at io.debezium.connector.postgresql.connection.PostgresConnection.<init>(PostgresConnection.java:65)
    ... 11 more
Caused by: java.net.SocketTimeoutException: connect timed out
    at java.net.PlainSocketImpl.socketConnect(Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)
    at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
    at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
    at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
    at java.net.Socket.connect(Socket.java:589)
    at org.postgresql.core.PGStream.<init>(PGStream.java:62)
    at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:144)
    ... 18 more

请问有关异常以及如何解决的问题吗?

我可能在这里缺少财产/配置吗?

1 个答案:

答案 0 :(得分:1)

您是否将postgres数据库端口配置为可从外部访问? IIRC RDS数据库使用SSL进行连接,因此可能还需要在postgres连接器中配置SSL。