Error in validation when running "validate lab initialize local replica set"


I have followed all the steps and everything seems to work OK but this throws an error:


Client experienced a timeout when connecting to the database - check that mongod

processes are running on ports 27001, 27002 and 27003, and that the 'm103-admin'

user authenticates against the admin database.

Everything seems OK

The cluster nodes have joined the replica set:

MongoDB Enterprise m103-example:PRIMARY> rs.isMaster()**
	"hosts" : [
	"setName" : "m103-example",
	"setVersion" : 3,
	"ismaster" : true,
	"secondary" : false,
	"primary" : "",
	"me" : "",

MongoDB processes are running OK:

vagrant@m103:~$ ps -eaf | grep mongod
vagrant   2662     1  1 15:29 ?        00:00:11 mongod -f mongod-repl-1.conf
vagrant   3002     1  1 15:37 ?        00:00:06 mongod -f mongod-repl-2.conf
vagrant   3036     1  1 15:37 ?        00:00:06 mongod -f mongod-repl-3.conf

They are running on the correct ports:

vagrant@m103:~$ netstat -tupln | grep 2700
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
tcp        0      0*               LISTEN      2662/mongod     
tcp        0      0*               LISTEN      2662/mongod     
tcp        0      0*               LISTEN      3002/mongod     
tcp        0      0*               LISTEN      3002/mongod     
tcp        0      0*               LISTEN      3036/mongod     
tcp        0      0*               LISTEN      3036/mongod  

The user exists too - if I try to recreate it, it gives error, so it means this does exist on admin database:

...   user: "m103-admin",
...   pwd: "m103-pass",
...   roles: [
...     {role: "root", db: "admin"}
...   ]
... })
2019-11-27T15:42:41.760+0000 E QUERY    [thread1] Error: couldn't add user: User "m103-admin@admin" already exists

Any idea why this is happening?

1 Like

Login to the primary node of the replica set and authenticate with the user you created by running the following:
use admin
db.auth("m103-admin", "m103-pass")

Note: you must use admin first, so please don’t exclude the first step.

Thanks - but this didn’t work - same problem…

What do you mean same problem?

I would be very surprised if you get the error Error: couldn’t add user: User “m103-admin@admin” already exists when running the command db.auth(…).

However, if you get Error: couldn’t add user … again when you run db.createUser(…) after using db.auth(…) well that’s normal since the origin message ends with User … already exists.

I found the problem - I was using the wrong replica-set name - had to clean the directories first (found the same problem with another user here too)

Hi @samiujan,

I’m glad your issue got resolved.

For any other users who might be facing similar issue, please make sure you are following the instructions mentioned in the Lab very carefully, otherwise the validator will throw an error.

In this particular case, the name of the replica set was m103-example, however the validator was expecting it to be m103-repl.

Shubham Ranjan
Curriculum Support Engineer