Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongodb can't start

Tags:

mongodb

today I updated my Mongo.. mongodb-stable (from 10gen repo)

but my service has down. the following command not working

$ sudo service mongodb start
$ start: Unknown job: mongodb

even this command not working

$ sudo /etc/init.d/mongodb start
$ Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service mongodb start
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start mongodb
start: Unknown job: mongodb

there is no mongo process running

$ ps -ef|grep mongo
$ user  9689  8121  0 13:01 pts/1    00:00:00 grep --color=auto mongo

log is here

tail /var/log/mongodb/mongodb.log 
Fri Dec 10 11:24:35 [conn4] end connection 127.0.0.1:54217
Fri Dec 10 11:25:35 [initandlisten] connection accepted from 127.0.0.1:54229 #5
Fri Dec 10 11:26:25 [initandlisten] connection accepted from 127.0.0.1:54243 #6
Fri Dec 10 11:26:30 [conn6] end connection 127.0.0.1:54243
Fri Dec 10 11:30:13 got kill or ctrl c or hup signal 15 (Terminated), will terminate after current cmd ends
Fri Dec 10 11:30:13 [interruptThread] now exiting
Fri Dec 10 11:30:13 dbexit: 

Fri Dec 10 11:30:13 [interruptThread] shutdown: going to close listening sockets...
Fri Dec 10 11:30:13 [interruptThread] closing listening socket: 5
Fri Dec 10 11:30:13 [interruptThread] closing listening socket: 6
Fri Dec 10 11:30:13 [interruptThread] closing listening socket: 7
Fri Dec 10 11:30:13 [interruptThread] closing listening socket: 8
Fri Dec 10 11:30:13 [interruptThread] shutdown: going to flush oplog...
Fri Dec 10 11:30:13 [interruptThread] shutdown: going to close sockets...
Fri Dec 10 11:30:13 [interruptThread] shutdown: waiting for fs preallocator...
Fri Dec 10 11:30:13 [interruptThread] shutdown: closing all files...
Fri Dec 10 11:30:13     closeAllFiles() finished

Fri Dec 10 11:30:13 [interruptThread] shutdown: removing fs lock...
Fri Dec 10 11:30:13 dbexit: really exiting now

for now, I'm running Mongo through this command just for a while, creating process manually

$ sudo mongod -f /etc/mongodb.conf

any idea? or has anyone updated Mongo-stable via Update manager?

Edits:

This mongodb version was v1.6.5 and it seems mongo team released it as stable with a bug. And they fixed it immediately at v1.7.4. You can see the major priority issue.

like image 733
jargalan Avatar asked Dec 10 '10 05:12

jargalan


People also ask

Why MongoDB is not opening?

In short, the problem of starting MongoDB server when running the command mongod may arise due to file permission or ownership issues.

How do I start MongoDB?

You can start MongoDB from a command line by issuing the mongod command and specifying options. For a list of options, see the mongod reference. MongoDB can also run as a Windows service. For details, see Start MongoDB Community Edition as a Windows Service.

How do you check MongoDB is started or not?

Following are some of the commands which can be used to get the status of Mongodb: service mongod status: Displays the status of MongodB service as like the screenshot given below. systemctl status mongod: Displays the same status of MongoDB service as like above command as shown in figure 1.


2 Answers

Bug has been reported and fixed.

https://jira.mongodb.org/browse/SERVER-2200

$ sudo apt-get purge mongodb-stable 
$ sudo apt-get install mongodb-stable 
(remove the lock file if present in /var/lib/mongodb)  
$ sudo init 6 

Then edit /etc/init/mongodb.conf removing the line "limit nofile 20000"

$ sudo vi /etc/init/mongodb.conf 
$ sudo service mongodb start
mongodb start/running, process 2351

Worked.

like image 135
Ankhaa Avatar answered Oct 07 '22 14:10

Ankhaa


Running Ubuntu 11.10 confirm you have the latest version of MongoDB:

$ mongod --version

db version v2.2.0

(If you don't have the latest version of MongoDB, follow the Ubuntu Installation instructions at: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/)

First confirm that the mongodb user/group has permission to write to the data directory:

$ sudo chown -R mongodb:mongodb /var/lib/mongodb/.

Start up MongoDB as a Daemon (background process) using the following command:

$ mongod --fork --dbpath /var/lib/mongodb/ --smallfiles --logpath /var/log/mongodb.log --logappend

To Shut Down MongoDB enter the Mongo CLI, access the admin and issue the shutdown command:

$ ./mongo

> use admin

> db.shutdownServer()

See: http://www.mongodb.org/display/DOCS/Starting+and+Stopping+Mongo

like image 39
nelsonic Avatar answered Oct 07 '22 16:10

nelsonic