unix - Is mongodb running? -


i have installed mongodb , php drivers on unix server.

my question how can tell if mongodb running? there simple command line query check status? if start once shell keep running if exit shell (this doesn't seem case). how can make mongodb connection persistent , auto start on server reboot?

i can run:

-bash-3.2$ su
password:
[root@xxx]# cd /var/lib
[root@xxx]# ./mongodb-linux-i686-1.6.5/bin/mongod
./mongodb-linux-i686-1.6.5/bin/mongod --help , startup options
wed feb 23 08:06:54 mongodb starting : pid=7271 port=27017 dbpath=/data/db/ 32-bit

** note: when using mongodb 32 bit, limited 2 gigabytes of data
** see http://blog.mongodb.org/post/137788967/32-bit-limitations

** warning: running in openvz. known broken!!!

wed feb 23 08:06:54 db version v1.6.5, pdfile version 4.5
wed feb 23 08:06:54 git version: 0eb017e9b2828155a67c5612183337b89e12e291
wed feb 23 08:06:54 sys info: linux domu-12-31-39-01-70-b4 2.6.21.7-2.fc8xen #1 smp fri
feb 15 12:39:36 est 2008 i686 boost_lib_version=1_37
wed feb 23 08:06:54 [initandlisten] waiting connections on port 27017
wed feb 23 08:06:54 [websvr] web admin interface listening on port 28017

if open seperate shell can then connect mongodb:

-bash-3.2$ cd /var/lib
-bash-3.2$ ./mongodb-linux-i686-1.6.5/bin/mongo
mongodb shell version: 1.6.5
connecting to: test
db.foo.find()
{ "_id" : objectid("4d63d7d3eb95985ab19c8feb"), "a" : 1 }

however if close initial shell can't connect:

-bash-3.2$ cd /var/lib
-bash-3.2$ ./mongodb-linux-i686-1.6.5/bin/mongo
mongodb shell version: 1.6.5
connecting to: test
wed feb 23 08:25:10 error: couldn't connect server 127.0.0.1 (anon):1154
exception: connect failed

check either:

   ps -edaf | grep mongo | grep -v grep  # "ps" flags may differ on os 

or

   /etc/init.d/mongod status 

or

   service mongod status 

to see if mongod running (you need root this, or prefix sudo)

check log file /var/log/mongo/mongo.log see if there problems reported


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -