I can connect to Mongo running on Config file, the validation cant

ERROR:
Client experienced a timeout when connecting to the database - check that mongod is running on the correct port, and that your user was created with the correct settings.

HOW I CAN CONNECT:
mongo admin --host localhost:27000 --username m103-admin --password m103-pass

WHAT THE LOG SAYS WHEN VALIDATING:
2020-02-27T14:19:31.640+0000 I NETWORK [listener] connection accepted from 127.0.0.1:32874 #1 (1 connection now open)
2020-02-27T14:19:32.640+0000 I NETWORK [conn1] end connection 127.0.0.1:32874 (0 connections now open)

WHAT I CHECKED:
Port: Correct
Username: Correct
Password: Correct
User Role: Correct
Server is running: Correct

Do anyone of you have any clue?

What do you get with this?
mongo --host 192.168.103.100:27000 --username m103-admin --password m103-pass --authenticationDatabase admin

Suggest you redact the config file from your post to avoid revealing potential answer to the lab.

Thanks for your quick response and good suggestion!

I can connect with your string:
vagrant@m103:~$ mongo --host 192.168.103.100:27000 --username m103-admin --password m103-pass --authenticationDatabase admin
MongoDB shell version v3.6.17
connecting to: mongodb://192.168.103.100:27000/?authSource=admin&gssapiServiceName=mongodb
Implicit session: session { “id” : UUID(“593f3503-110c-46c4-893c-afbae27ad5c7”) }
MongoDB server version: 3.6.17
Server has startup warnings:
2020-02-27T14:27:55.983+0000 I STORAGE [initandlisten]
2020-02-27T14:27:55.983+0000 I STORAGE [initandlisten] ** WARNING: Using the XFS filesystem is strongly recommended with the WiredTiger storage engine
2020-02-27T14:27:55.983+0000 I STORAGE [initandlisten] ** See http://dochub.mongodb.org/core/prodnotes-filesystem
2020-02-27T14:27:56.714+0000 I CONTROL [initandlisten]
2020-02-27T14:27:56.714+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is ‘always’.
2020-02-27T14:27:56.714+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2020-02-27T14:27:56.714+0000 I CONTROL [initandlisten]
2020-02-27T14:27:56.714+0000 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is ‘always’.
2020-02-27T14:27:56.714+0000 I CONTROL [initandlisten] ** We suggest setting it to ‘never’
2020-02-27T14:27:56.714+0000 I CONTROL [initandlisten]
MongoDB Enterprise >

Could those warnings cause that missbehavior?

If you test if you can connect with the following

just before running the validation script. It is the problem since you just shutdown the server. The validation script cannot connect if you shutdown the server.

Good point, I might have copied the wrong string into this thread, sorry.
I didnt use this eval before trying to validate… :smiley:

Can you share a screenshot of the connection string from before, and the validation script run… on one screenshot. I would like to see it successfully connect and the validation script fail immediately afterwards.

Yes of course, thanks 1000 times for your afford again!:

No problem @Said_49397 :slight_smile:

Login again and share the output of db.getUsers() on the admin db as a screenshot.

The output of db.adminCommand( { getCmdLineOpts: 1 } ) would also be helpful.

1 Like

2020-02-27T16:35:44.153+0000 E QUERY [thread1] Error: not master and slaveOk=false :

after rs.slaveOk():
image

Thanks for your reply:

You’ll need to shutdown the server, fix the config file as below and start it up again:

  1. Remove the space between “localhost,” and “192.168.103.100”
  2. Delete replication and replSetName
1 Like

It looks like the server was restarted with different configuration between post#1 and post#7.

In post#1 he was able to connect with localhost and in post#7 he could with 192.168.100.103.

1 Like

Thank you so much!!!

Removing the replication and replSetName solved it!

Closing this thread as the issue has been resolved.