Mongodb: why is my mongo server using two PID's?

Posted by Lucas on Server Fault See other posts from Server Fault or by Lucas
Published on 2014-06-07T08:57:31Z Indexed on 2014/06/07 9:27 UTC
Read the original article Hit count: 403

Filed under:
|
|

I started my mongo with the following command:

[lucas@ecoinstance]~/node/nodetest2$ sudo mongod --dbpath /home/lucas/node/nodetest2/data
2014-06-07T08:46:30.507+0000 [initandlisten] MongoDB starting : pid=6409 port=27017 dbpat
h=/home/lucas/node/nodetest2/data 64-bit host=ecoinstance
2014-06-07T08:46:30.508+0000 [initandlisten] db version v2.6.1
2014-06-07T08:46:30.508+0000 [initandlisten] git version: 4b95b086d2374bdcfcdf2249272fb55
2c9c726e8
2014-06-07T08:46:30.508+0000 [initandlisten] build info: Linux build14.nj1.10gen.cc 2.6.3
2-431.3.1.el6.x86_64 #1 SMP Fri Jan 3 21:39:27 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49
2014-06-07T08:46:30.509+0000 [initandlisten] allocator: tcmalloc
2014-06-07T08:46:30.509+0000 [initandlisten] options: { storage: { dbPath: "/home/lucas/n
ode/nodetest2/data" } }
2014-06-07T08:46:30.520+0000 [initandlisten] journal dir=/home/lucas/node/nodetest2/data/
journal
2014-06-07T08:46:30.520+0000 [initandlisten] recover : no journal files present, no recov
ery needed
2014-06-07T08:46:30.527+0000 [initandlisten] waiting for connections on port 27017

It appears to be working, as I can execute mongo and access the server. However, here are the process running mongo:

[lucas@ecoinstance]~/node/testSite$ ps aux | grep mongo
root      6540  0.0  0.2  33424  1664 pts/3    S+   08:52   0:00 sudo mongod --dbpath /ho
me/lucas/node/nodetest2/data                                                            
root      6541  0.6  8.6 522140 52512 pts/3    Sl+  08:52   0:00 mongod --dbpath /home/lu
cas/node/nodetest2/data                                                                 
lucas     6554  0.0  0.1   7836   876 pts/4    S+   08:52   0:00 grep mongo

As you can see, there are two PID's for mongo. Before I ran sudo mongod --dbpath /home/lucas/node/nodetest2/data, there were none (besides the grep of course). How did my command spawn two PID's, and should I be concerned? Any suggestions or tips would be great.

Additional Info

In addition, I may have other issues that might suggest a cause. I tried running mongo with --fork --logpath /home/lucas..., but it did not work. More information below:

[lucas@ecoinstance]~/node/nodetest2$ sudo mongod --dbpath /home/lucas/node/nodetest2/data
 --fork --logpath /home/lucas/node/nodetest2/data/                                      
about to fork child process, waiting until server is ready for connections.
forked process: 6578
ERROR: child process failed, exited with error number 1

[lucas@ecoinstance]~/node/nodetest2$ ls -l data/
total 163852
drwxr-xr-x 2 mongodb nogroup     4096 Jun  7 08:54 journal
-rw------- 1 mongodb nogroup 67108864 Jun  7 08:52 local.0
-rw------- 1 mongodb nogroup 16777216 Jun  7 08:52 local.ns
-rwxr-xr-x 1 mongodb nogroup        0 Jun  7 08:54 mongod.lock
-rw------- 1 mongodb nogroup 67108864 Jun  7 02:08 nodetest1.0
-rw------- 1 mongodb nogroup 16777216 Jun  7 02:08 nodetest1.ns

Also, my db path folder is not the original location. It was originally created under the default /var/lib/mongodb/ and moved to my local data folder. This was done after shutting down the server via /etc/init.d/mongod stop.

I have a Debian Wheezy server, if it matters.

© Server Fault or respective owner

Related posts about database

Related posts about mongodb