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.
Best Answer
I found the problem. This is the mongo client issue. I added mongodb repository and install mongo shell