I am able to start my mongo server with the following command:
[lucas@ecoinstance]~/node/nodetest2$ sudo mongod --dbpath /home/lucas/node/nodetest2/data
--fork --logpath /var/log/mongodb/mongod-nodetest2.log
about to fork child process, waiting until server is ready for connections.
forked process: 10293
child process started successfully, parent exiting
but when I try to remove the sudo
, I get the following error:
[lucas@ecoinstance]~/node/nodetest2$ mongod --dbpath /home/lucas/node/nodetest2/
data --fork --logpath /var/log/mongodb/mongod-nodetest2.log
about to fork child process, waiting until server is ready for connections.
forked process: 10284
ERROR: child process failed, exited with error number 1
Here is additional information:
[lucas@ecoinstance]~/node/nodetest2$ ls -l data/*
-rw------- 1 mongodb mongodb 67108864 Jun 7 20:57 data/local.0
-rw------- 1 mongodb mongodb 16777216 Jun 7 20:57 data/local.ns
-rwxr-xr-x 1 mongodb mongodb 6 Jun 7 20:57 data/mongod.lock
-rw------- 1 mongodb mongodb 67108864 Jun 7 02:08 data/nodetest1.0
-rw------- 1 mongodb mongodb 16777216 Jun 7 02:08 data/nodetest1.ns
-rw------- 1 mongodb mongodb 67108864 Jun 7 23:01 data/nodetest2.0
-rw------- 1 mongodb mongodb 16777216 Jun 7 23:01 data/nodetest2.ns
data/journal:
total 3145744
-rw------- 1 mongodb mongodb 1073741824 Jun 7 23:01 j._0
-rw------- 1 root root 88 Jun 7 23:01 lsn
-rw------- 1 mongodb mongodb 1073741824 Jun 6 03:10 prealloc.1
-rw------- 1 mongodb mongodb 1073741824 Jun 6 03:12 prealloc.2
[lucas@ecoinstance]~/node/nodetest2$ ls -l /etc/mongod.conf
-rw-r--r-- 1 mongodb mongodb 1701 May 5 15:07 /etc/mongod.conf
[lucas@ecoinstance]~/node/nodetest2$ ls -l /var/log/mongodb/
total 120
-rw-r--r-- 1 mongodb mongodb 96801 Jun 7 05:48 mongod.log
-rw-r--r-- 1 root root 15625 Jun 8 00:18 mongod-nodetest2.log
-rw-r--r-- 1 mongodb mongodb 2805 Jun 7 20:38 mongod-nodetest2.log.2014-06-07T20-57-47
I cannot find a similar problem. What is the cause of this issue?
Update Thanks to Asya's answer below, I ran a similar command, but changed the location of the log file to one which does not need root access privileges:
mongod --dbpath /home/lucas/node/nodetest2/data --fork --logpath /home/lucas/data/log/mongodb/mongod-nodetest2.log
I also encountered an issue where mongod
was running in the background, similar to this question. Stopping that process before running the above command worked for me.
Thanks Asya!