Lab: change the default dbpath - test failure

I am using the correct dbpath to start the mongod process with the mentioned configuration file, as you can see from the image below.

Starting mongod process

But running the test results in failure, stating to use the path /var/mongodb/db, which I used as you can see from the image above

Testing mongod process

Did I have to access the server using mongo shell?

Have you completed all the steps of the lab?
Like the user creation etc

2 Likes

I tried that, it is working now
I thought the test is for start the mongod process with the provided destination

Thank you

Hi @Mahalingam_Sundararaj,

I’m glad your issue got resolved. Let us know if you have any other questions.

Start a new thread with your issues. Explained what you tried. Post a screenshot of the issues you got.

If you have same error, we have the same answer.

The post screenshots of

  1. Running the command ls -ld /var/mongodb/db
  2. Of the configuration file
  3. Of the terminal where you started momgod
  4. Of the terminal where you paste the 4 command

The directory does not exists, them it means you did not do the mkdir correctly.

Post screenshot of redoing the mkdir command.

its ceated bro,now in same terminal i run mongod and then that 4 command right ?

Still missing screenshot

  1. Make sure to use mkdir -p flag to create directory tree
  2. Run mongod process with config file
  3. Make sure to do the final step of creating user and then do the tests

I forgot to do the final step

You need to start mongod with the configuration file in the IDE terminal.

Please ignore this and consider next post from @Mahalingam_Sundararaj

***NonExistingPath: Data directory*** means you did not created the directory correctly.

So supply

You’re not using --config flag to start mongod process

mongod --config mongod.conf

1 Like

can u post your ans pick…

This is the answer for the error

1 Like

No. Review lecture Chapter 1: The Mongod - Configuration File.

1 Like
  1. Make directory using “mkdir -p var/mongodb/db”
  2. Run mongod process using the conf file provided. Use the command “mongod --config mongod.conf” to start the mongod process
  3. Then create user

I think it will solve the issue, if not go through this again https://university.mongodb.com/mercury/M103/2021_February_2/chapter/Chapter_1_The_Mongod/lesson/5a9719abc9d4ec11e704edc6/lecture

bash-4.4# mkdir -p var/mongodb/db
bash-4.4# mongod --config mongod.conf
2021-02-17T06:19:07.814+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none’
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] MongoDB starting : pid=339 port=27000 dbpath=“/var/mongodb/db/" 64-bit host=v147QNwYtB8ZeWXoJP
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] db version v4.0.5
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1g 21 Apr 2020
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] allocator: system
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] modules: none
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] build environment:
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] distarch: x86_64
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] target_arch: x86_64
2021-02-17T06:19:07.826+0000 I CONTROL [initandlisten] options: { config: “mongod.conf”, net: { bindIp: “localhost”, port: 27000 }, security: { authorization: “enabled” }, storage: { dbPath: ““/var/mongodb/db/”" } }
2021-02-17T06:19:07.874+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory “/var/mongodb/db/" not found., terminating
2021-02-17T06:19:07.874+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets…
2021-02-17T06:19:07.874+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27000.sock
2021-02-17T06:19:07.874+0000 I CONTROL [initandlisten] now exiting
2021-02-17T06:19:07.874+0000 I CONTROL [initandlisten] shutting down with code:100

i am getting this error and my config file is this
storage:
dbPath: “/var/mongodb/db/"
net:
bindIp : localhost
port : 27000
security:
authorization: enabled
whats the error pls tell

2021-02-17T06:19:07.874+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory “/var/mongodb/db/" not found., terminating

This is the problem, try mkdir -p /var/mongodb/db and then start the mongod process