Unable to shutdown mongod

I created a config file and used it to bring up mongod but I’m facing the below error whenever I issue db.shutdownServer().

image

Config file:
storage:
dbPath: “/var/mongodb/db/”
systemLog:
path: “/var/mongodb/db/mongod.log”
destination: “file”
logAppend: true
net:
port: 27000
bindIp : “127.0.0.1,192.168.103.100”
security:
authorization: enabled
processManagement:
fork: true
operationProfiling:
mode: slowOp
slowOpThresholdMs: 50

Can you please advise what am I missing?

Thanks, Aravinth.

What’s the title of the lab?

Lab - Configuration file

You got there are no users authenticated. It means you have not authenticate yourself with the server. You have to authenticate with a user and password.

I could be silly. When do I do that - when connecting to mongo shell? Can you pls guide me how. Thanks.

You should start with course M001. This is Basic Cluster Administration. You should know how to authenticate by now.

There is 3 ways.
1.Command line options
2.Connection string
3.Command db.auth()

https://docs.mongodb.com/manual/mongo/

I meant I tried launching mongo shell using the new user that I created m103-admin. Do you mean I also need to include --authenticationDatabase keyword?

mongo --username m103-admin --password xxxxx --authenticationDatabase admin --config mongod.conf

You should try it to see what it does.

Hi @Aravinthkumar_74587,

Not this. Please read our documentation on how to use the mongo command.

In this case, I would use something like this :

mongo --port <port_number> --username <username> --password <password> --authenticationDatabase admin

Hope it helps!

~ Shubham

1 Like

Thank you @Shubham_Ranjan. Sorry, I mixed up mongo shell command with config option in my post but I tried here without that. Just realised that I wasn’t using authenticationDatabase option as you highlighted. It worked on using that option.