Uploaded image for project: 'Debezium'
  1. Debezium
  2. DBZ-5003

Can't use 'local' database through mongos


      Bug report

      For bug reports, provide this information, please:

      What Debezium connector do you use and what version?

      debezium-connector-mongodb version 1.9.0.Final

      What is the connector configuration?

        "name": "test-mongodb-connector",
        "config": {
          "connector.class": "io.debezium.connector.mongodb.MongoDbConnector",
          "mongodb.hosts": "mongos.mongo-cluster:27017",
          "mongodb.name": "test_mongodb",
          "collection.include.list": "public.test_collection",
          "capture.mode": "oplog"

      What is the captured database version and mode of deployment?

      MongoDB v4.2.18, Kubernetes

      What behaviour do you expect?

      The connector is successfully created when I specify the data to connect to the shared MongoDB cluster.

      What behaviour do you see?

      The connector creation fails with the error:

        "error_code": 400,
        "message": "Connector configuration is invalid and contains the following 1 error(s):\nUnable to connect: Command failed with error 20 (IllegalOperation): 'Can't use 'local' database through mongos' on server mongos.mongo-cluster:27017. The full response is {\"ok\": 0.0, \"errmsg\": \"Can't use 'local' database through mongos\", \"code\": 20, \"codeName\": \"IllegalOperation\", \"operationTime\": {\"$timestamp\": {\"t\": 1650033077, \"i\": 2}}, \"$clusterTime\": {\"clusterTime\": {\"$timestamp\": {\"t\": 1650033077, \"i\": 2}}, \"signature\": {\"hash\": {\"$binary\": {\"base64\": \"YCO98zagOHfEzh2/tdz9tdYLnIw=\", \"subType\": \"00\"}}, \"keyId\": 7079052315168079876}}}\nYou can also find the above list of errors at the endpoint `/connector-plugins/{connectorType}/config/validate`"

      Do you see the same behaviour using the latest released Debezium version?


      Implementation ideas (optional)

      I suggest using "config" database if the database exists, otherwise, use "local" database to get MongoDB version during connector validation.

            Unassigned Unassigned
            andrey.pustovetov@gmail.com Andrey Pustovetov
            0 Vote for this issue
            3 Start watching this issue