创建mongo debezium连接器时出现身份验证错误

时间:2020-03-29 19:10:57

标签: mongodb authentication apache-kafka-connect debezium

我正在尝试在下面创建mongo debezium连接器,但收到身份验证错误。请在下面找到详细信息

POST http://localhost:8083/connectors

有效载荷:

{
  "name": "mongodb-connector",
  "config": {
    "connector.class": "io.debezium.connector.mongodb.MongoDbConnector",
    "mongodb.hosts": "host1:27020,host2:27020",
    "mongodb.name": "op_log",
    "mongodb.user": "useradmin",
    "mongodb.password":"userpassword",
    "mongodb.authsource":"admin"
  }
}

错误详细信息

com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='useradmin', source='config', password=<hidden>, mechanismProperties={}}
    at com.mongodb.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:61)
    at com.mongodb.connection.DefaultAuthenticator.authenticate(DefaultAuthenticator.java:32)
    at com.mongodb.connection.InternalStreamConnectionInitializer.authenticateAll(InternalStreamConnectionInitializer.java:99)
    at com.mongodb.connection.InternalStreamConnectionInitializer.initialize(InternalStreamConnectionInitializer.java:44)
    at com.mongodb.connection.InternalStreamConnection.open(InternalStreamConnection.java:115)
    at com.mongodb.connection.DefaultServerMonitor$ServerMonitorRunnable.run(DefaultServerMonitor.java:128)
    at java.lang.Thread.run(Thread.java:748)
Caused by: com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server 10.51.19.113:27020. The full response is { "operationTime" : { "$timestamp" : { "t" : 1585508571, "i" : 1 } }, "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : 18, "codeName" : "AuthenticationFailed", "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1585508571, "i" : 1 } }, "signature" : { "hash" : { "$binary" : "f5msklBnUsfygvd+lCDdJVj3/a4=", "$type" : "0" }, "keyId" : { "$numberLong" : "6784723618031992833" } } } }
    at com.mongodb.connection.CommandHelper.createCommandFailureException(CommandHelper.java:170)
    at com.mongodb.connection.CommandHelper.receiveCommandResult(CommandHelper.java:123)
    at com.mongodb.connection.CommandHelper.executeCommand(CommandHelper.java:32)
    at com.mongodb.connection.SaslAuthenticator.sendSaslStart(SaslAuthenticator.java:95)
    at com.mongodb.connection.SaslAuthenticator.authenticate(SaslAuthenticator.java:45)
    ... 6 more

看到错误,该机制为null,在mongodb中,我使用SCRAM-SHA-1作为身份验证机制。

1 个答案:

答案 0 :(得分:0)

已解决。显然我正在使用旧版本的mongodb连接器jar(1个月大)。最新更新于2020年3月24日发布。

您可以在这里获得这些罐子-https://debezium.io/documentation/reference/1.1/connectors/mongodb.html#mongodb-deploying-a-connector