0

I have primary mongodb v3.4.10 on ubuntu (bare metal) with these users:

{
    "_id" : "admin.root",
    "user" : "root",
    "db" : "admin",
    "roles" : [
        {
            "role" : "root",
            "db" : "admin"
        }
    ]
}

Secondray is docker image with this config (I start secondary-newnode with initial sync and it become secondary):

    services:
      mongodb:
        image: mongo:3.4.15-jessie
        restart: always
        volumes:
          - /opt/mongodb/data:/data/db
          - /opt/mongodb/replication.key:/data/db/ssl/replication.key
        network_mode: "host"
        command: --storageEngine=wiredTiger --wiredTigerCacheSizeGB=12 --journal --replSet rs0 --bind_ip localhost,192.168.50.3 --auth --keyFile /data/db/ssl/replication.key

Now, when i want connect to secondary, with mongo shell authenticataion failed with

    Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18, codeName: "AuthenticationFailed" }
    0

forced to new node become PRIMARY not work.

1

I found the problem. This is the mongo client issue. I added mongodb repository and install mongo shell

echo "deb http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" > /etc/apt/sources.list.d/mongodb.list

# apt-get update; apt-get install mongodb-org-shell

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.