Type of mongo file

what is difference between /var/log/mongodb/mongod.log and /db/dbpath/mogo.log that are given at time of monogo startup

No difference other than path
Just it is writing logs to different directory locations
You can give any dir where you have read/write privs to start a mongod
But please follow your lab instructions and stick to the paths they recommend
For some of the paths you(vagrant) may have write privs but for others like /var you need sudo privs to create sub dirs

One more Question :slight_smile:

after creating my first user I stoped mongod server using db.shutdownserver , now i try to connect but getting following error.
how can we startup server

startup mongo server

[mongo@localhost init.d] service mongod start Error starting mongod. /var/run/mongodb/mongod.pid exists. [mongo@localhost init.d]

[mongo@localhost init.d] ps -ef | grep -i mongod mongo 4514 4400 0 19:43 pts/0 00:00:00 grep -i mongod [mongo@localhost init.d]

error while connecting mongo

[mongo@localhost ~] mongo --username root --password root123 --authenticationDatabase admin MongoDB shell version v4.0.10 connecting to: mongodb:// 2019-06-06T19:33:37.185-0700 E QUERY [js] Error: couldn't connect to server, connection attempt failed: SocketException: Error connecting to :: caused by :: Connection refused : connect@src/mongo/shell/mongo.js:344:17 @(connect):2:6 exception: connect failed [mongo@localhost ~]

Try to remove /var/run/mongodb/mongod.pid file and start again
You may need sudo privs
This link may help

how can view value of parameter define in mongo.conf from mongo client

How we can check value of mongo DB.conf from mongo prompt

You can always check your config file


MongoDB Enterprise Cluster0-shard-0:PRIMARY> use admin
switched to db admin
MongoDB Enterprise Cluster0-shard-0:PRIMARY> db.adminCommand( { getCmdLineOpts: 1 } )