我正在尝试设置一个 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
我的系统配置:
融合-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
我正在使用这个文档来创建密钥和信任链
任何想法如何解决这个问题?