MongoDb Exiting with Code: 100

I know that there are other questions similar to this, but they do not have the same exact log and I have tried many supposed solutions that haven't worked. This is my log:

2018-05-16T00:31:32.193-0400 I CONTROL  [initandlisten] MongoDB starting : pid=16976 port=27017 dbpath=/data/db 64-bit host=Edan
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten] db version v3.6.1
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten] git version: 025d4f4fe61efd1fb6f0005be20cb45a004093d1
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten] OpenSSL version: OpenSSL 1.0.2o  27 Mar 2018
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten] allocator: system
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten] modules: none
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten] build environment:
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten]     distarch: x86_64
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten]     target_arch: x86_64
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten] options: {}
2018-05-16T00:31:32.194-0400 I STORAGE  [initandlisten] exception in initAndListen: DBPathInUse: Unable to lock the lock file: /data/db/mongod.lock (Resource temporarily unavailable). Another mongod instance is already running on the /data/db directory, terminating
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten] now exiting
2018-05-16T00:31:32.194-0400 I CONTROL  [initandlisten] shutting down with code:100

I think that I closed my terminal window before shutting down the server, and now I can't get it to work. Any help would be greatly appreciated.

1 answer

  • answered 2018-05-16 04:47 madushak

    It is mentioned in the log that "Another mongod instance is already running" and you need to gracefully shut down it before starting the server again.

    If it didn't work, forcefully kill the mongod process and remove the lock file.

    If you are on unix environment,

    1. Run ps -A | grep mongo
    2. Copy the process id(s)
    3. Run kill -9 [process id]

    And then remove the mongo lock file

    1. Run sudo rm /data/db/mongod.lock