微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Kafka Mongodb Sink Connector - 无法找到请求目标的有效认证路径

如何解决Kafka Mongodb Sink Connector - 无法找到请求目标的有效认证路径

我正在尝试设置 mongodb 接收器连接器,但在启动时出现错误

错误

{"error_code":400,"message":"Connector configuration is invalid and contains the following 1 error(s):\nConfiguration is not defined: topic\nUnable to connect to the server.\nYou can also find the above list of errors at the endpoint `/connector-plugins/{connectorType}/config/validate`"}

在日志文件中进一步挖掘,我发现了这两个错误

Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

我的 systemd 配置:

confluent-kafka-connect.service

[Install]
Environment=KAFKA_OPTS="-Djavax.net.ssl.trustStore=/var/mongo-ssl/mongodb_ca.ts -Djavax.net.ssl.trustStorePassword=xxx -Djavax.net.ssl.keyStore=/var/mongo-ssl/keystore.pkcs12 -Djavax.net.ssl.keyStorePassword=xxx"
WantedBy=multi-user.target

卷曲命令

curl --noproxy "*" -k -X PUT https://xx.xx.xx:8443/connectors/kafka-connect-sink-mongo-test/config -H "Content-Type: application/json" -d ' {

        "connector.class": "com.mongodb.kafka.connect.MongoSinkConnector","writemodel.strategy": "com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneBusinessKeyTimestampStrategy","tasks.max": "1","group.id": "kafka_connect","transforms": "WrapKey","field.renamer.regex": "[]","topic.override.sourceB.document.id.strategy": "com.mongodb.kafka.connect.sink.writemodel.strategy.UpdateOneBusinessKeyTimestampStrategy","field.renamer.mapping": "[]","database": "xxx","document.id.strategy": "com.mongodb.kafka.connect.sink.processor.id.strategy.PartialValueStrategy","value.converter": "io.confluent.connect.avro.AvroConverter","transforms.WrapKey.field": "xxx","transforms.WrapKey.type": "org.apache.kafka.connect.transforms.HoistField$Key","key.converter": "org.apache.kafka.connect.storage.StringConverter","value.projection.list": "xxx","topics": "xxx","max.num.retries": "3","delete.on.null.values": "false","collection": "xxx","topic.override.sourceB.collection": "xxx","change.data.capture.handler": "","key.converter.schemas.enable": "false","value.converter.schema.registry.url": "http://xxx:8081/schema/","connection.uri": "mongodb://xxx:xxx@some.url:port/xxx?ssl=true","value.converter.schemas.enable": "true","max.batch.size": "0","post.processor.chain": "com.mongodb.kafka.connect.sink.processor.DocumentIdAdder","retries.defer.timeout": "5000","rate.limiting.timeout": "0","key.converter.schema.registry.url": "http://xxx:8081/schema/","rate.limiting.every.n": "0","value.projection.type": "whitelist"
   
}'

日志

Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: com.mongodb.MongoSocketWriteException: Exception sending message
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.InternalStreamConnection.translateWriteException(InternalStreamConnection.java:551)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.InternalStreamConnection.sendMessage(InternalStreamConnection.java:433)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.InternalStreamConnection.sendCommandMessage(InternalStreamConnection.java:273)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.InternalStreamConnection.sendAndReceive(InternalStreamConnection.java:257)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.CommandHelper.sendAndReceive(CommandHelper.java:83)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.CommandHelper.executeCommand(CommandHelper.java:33)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initializeConnectionDescription(InternalStreamConnectionInitializer.java:105)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:62)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.InternalStreamConnection.open(InternalStreamConnection.java:129)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:117)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at java.lang.Thread.run(Thread.java:748)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: Caused by: javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.Alerts.getSSLException(Alerts.java:198)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.SSLSocketImpl.fatal(SSLSocketImpl.java:1967)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:331)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.Handshaker.fatalSE(Handshaker.java:325)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1688)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:226)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.Handshaker.processLoop(Handshaker.java:1082)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.Handshaker.process_record(Handshaker.java:1010)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1079)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1388)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:765)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.socketStream.write(SocketStream.java:99)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: at com.mongodb.internal.connection.InternalStreamConnection.sendMessage(InternalStreamConnection.java:430)
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: ... 9 more
Jan  7 10:42:52 ip-xx-xx-xx-xx connect-distributed: Caused by: sun.security.validator.ValidatorException: PKIX path building Failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target

我正在使用 this 文档来创建密钥和信任链

有什么想法可以解决这个问题吗?

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。