Shutdown error with code 48-Lab: Change the Default DB Path

Hi ,

i have used the below commands

storage:
dbPath: /var/mongodb/db

net:
bindIp: localhost, 192.168.103.100
port: 2700

security:
authorization: enabled

how ever when i try to execute with mongod -f mongod.conf it gives below error
shutdown error with code 48-Lab.

please help.

Hi @Nevin_Ninan
I’ve tried to emulate the error, it could be a process is already running on that port.

killall mongod
mongod -f mongod.conf

Make the storage directory is created, as the exercise indicates. Also, the port is 27000 not 2700.


Try to include the full log, for example:

 E STORAGE  (...) SocketException: Address in use
 I CONTROL (...) now exiting
 I CONTROL  (...) shutting down with code:48

Reading this will help you to solve the problem.

Also this IP is not applicable in IDE.It is used in vagrant environment
So please remove it and use just localhost for bindIp

Hi Santiago,

I tried what you mentioned and i changed the port number"
storage:
dbPath: /var/mongodb/db

net:
bindIp: localhost
port: 27000

security:
authorization: enabled

I am getting new error code

2020-12-20T14:22:50.289+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none’
2020-12-20T14:22:50.295+0000 I CONTROL [initandlisten] MongoDB starting : pid=336 port=27000 dbpath=/var/mongodb/db 64-bit host=ZCW4V9WUBgmSxizCKs
2020-12-20T14:22:50.295+0000 I CONTROL [initandlisten] db version v4.0.5
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1g 21 Apr 2020
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] allocator: system
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] modules: none
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] build environment:
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] distarch: x86_64
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] options: { config: “mongod.conf”, net: { bindIp: “localhost”, port: 27000 }, security: { authorization: “enabled” }, storage: { dbPath: “/var/mongodb/db” } }
2020-12-20T14:22:50.336+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /var/mongodb/db not found., terminating
2020-12-20T14:22:50.336+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets…
2020-12-20T14:22:50.336+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27000.sock
2020-12-20T14:22:50.336+0000 I CONTROL [initandlisten] now exiting
2020-12-20T14:22:50.336+0000 I CONTROL [initandlisten] shutting down with code:100

not sure if i am missing out something.

Thanks

Hi Ramachandra,

Thanks for replying back on previous doubt

I am getting a new error please find below:

2020-12-20T14:22:50.289+0000 I CONTROL [main] Automatically disabling TLS 1.0, to force-enable TLS 1.0 specify --sslDisabledProtocols ‘none’
2020-12-20T14:22:50.295+0000 I CONTROL [initandlisten] MongoDB starting : pid=336 port=27000 dbpath=/var/mongodb/db 64-bit host=ZCW4V9WUBgmSxizCKs
2020-12-20T14:22:50.295+0000 I CONTROL [initandlisten] db version v4.0.5
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] git version: 3739429dd92b92d1b0ab120911a23d50bf03c412
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] OpenSSL version: OpenSSL 1.1.1g 21 Apr 2020
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] allocator: system
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] modules: none
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] build environment:
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] distarch: x86_64
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] target_arch: x86_64
2020-12-20T14:22:50.296+0000 I CONTROL [initandlisten] options: { config: “mongod.conf”, net: { bindIp: “localhost”, port: 27000 }, security: { authorization: “enabled” }, storage: { dbPath: “/var/mongodb/db” } }
2020-12-20T14:22:50.336+0000 I STORAGE [initandlisten] exception in initAndListen: NonExistentPath: Data directory /var/mongodb/db not found., terminating
2020-12-20T14:22:50.336+0000 I NETWORK [initandlisten] shutdown: going to close listening sockets…
2020-12-20T14:22:50.336+0000 I NETWORK [initandlisten] removing socket file: /tmp/mongodb-27000.sock
2020-12-20T14:22:50.336+0000 I CONTROL [initandlisten] now exiting
2020-12-20T14:22:50.336+0000 I CONTROL [initandlisten] shutting down with code:100

This are the changes i made in config file:

storage:
dbPath: /var/mongodb/db

net:
bindIp: localhost
port: 27000

security:
authorization: enabled

Thanks for including the logs.

Then we need to create the storage path
mkdir -p <dataDirectoryHere>

Hi ,

I have made the changes

storage:
dbPath: mkdir -p /var/mongodb/db
net:
bindIp: localhost
port: 27000

security:
authorization: enabled

still gives the same error:

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

Thanks
Nevin

The config file was correct. Just revert it back.

The command is to be run in the shell

mkdir -p /var/mongodb/db

Please, read the exercise carefully.