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

Hi

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

validate_lab_initialize_local_replica_set

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" : [
		"192.168.103.100:27001",
		"192.168.103.100:27002",
		"192.168.103.100:27003"
	],
	"setName" : "m103-example",
	"setVersion" : 3,
	"ismaster" : true,
	"secondary" : false,
	"primary" : "192.168.103.100:27001",
	"me" : "192.168.103.100:27001",
 ..

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 192.168.103.100:27001   0.0.0.0:*               LISTEN      2662/mongod     
tcp        0      0 127.0.0.1:27001         0.0.0.0:*               LISTEN      2662/mongod     
tcp        0      0 192.168.103.100:27002   0.0.0.0:*               LISTEN      3002/mongod     
tcp        0      0 127.0.0.1:27002         0.0.0.0:*               LISTEN      3002/mongod     
tcp        0      0 192.168.103.100:27003   0.0.0.0:*               LISTEN      3036/mongod     
tcp        0      0 127.0.0.1:27003         0.0.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:

db.createUser({
...   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.

Thanks,
Shubham Ranjan
Curriculum Support Engineer