I successfully created a replica set using the instructions from the “Lab - Initiate a Replica Set Locally”, but when I run the validation script I get the following 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.”
I used the following command to create the user on the admin database:
db.createUser({
user: “m103-admin”,
pwd: “m103-pass”,
roles: [
{role: “root”, db: “admin”}
]
})
and when I run the “db.getUsers()” command from the primary node I get the following output:
[
{
“_id” : “admin.m103-admin”,
“user” : “m103-admin”,
“db” : “admin”,
“roles” : [
{
“role” : “root”,
“db” : “admin”
}
]
}
]
I’m able to successfully connect to the replica set with each of the following commands:
mongo --host “m103-example/192.168.103.100:27001” -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”
mongo --host “m103-example/192.168.103.100:27002” -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”
mongo --host “m103-example/192.168.103.100:27003” -u “m103-admin” -p “m103-pass” --authenticationDatabase “admin”
Which means the mongos are running on the correct ports and the m103-admin user does indeed authenticate against the admin database, so why am I getting this error instead of an authentication code?