0

I am trying to run my MongoDB on my Linux remote server and keep it running without shutting down when the terminal is closed etc.

I am attempting to use this command to run it as a daemon:

sudo mongod --fork --logpath /var/log/mongodb.log

When I run that command i get the following error:

build environment:
distmod: ubuntu1404
distarch: x86_64
target_arch: x86_64
options: { systemLog: { destination: "file", path: "/var/log/mongodb.log" } }
exception in initAndListen: NonExistentPath: Data directory /data/db not found., terminating
now exiting
shutting down with code:100

I am not sure how to eliminate this issue so that the mongoDB can keep running in the background on my server. Any help is greatly appreciated.

Grokify
  • 15,092
  • 6
  • 60
  • 81
Logi
  • 105
  • 2
  • 13
  • You really should not need to do this. If you followed the default Ubuntu install instructions then you can `systemctrl enable` and simply run as a service. There is also a default configuration which creates the data directory and everything. So I guess you just did not read until the end of the documented process. Nonetheless, the whole "create directory" thing has been answered many times, but really you should be using the default install process. – Neil Lunn Jun 11 '18 at 04:09
  • Also see the [official documentation](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-ubuntu/) and a related issue on askubuntu.com in case the service is not automatically enabled. [How to start MongoDB server on system start?](https://askubuntu.com/questions/61503/how-to-start-mongodb-server-on-system-start) – Neil Lunn Jun 11 '18 at 04:13

0 Answers0