开发者

Mongodb can't start

开发者 https://www.devze.com 2023-01-30 09:21 出处:网络
today I updated my Mongo.. mongodb-stable (from 10gen repo) but my service has down. the following command not working

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.


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.


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


In shell launching $ mongo and # mongo I was able to find out that

  • /data/db is not present
    sudo mkdir -p /data/db
  • mongod is now an upstart
    sudo start --system mongod

(valid for Ubuntu 14.04 trusty)


I run ubuntu server 10.04 minimal installation in a chroot environment. I always have same massage even after I executed the above. Only the following sudo mongod -f /etc/mongodb.conf works, any hints?


you should have mentioned which LINUX distribution and version you are using..

works fine for me on Fedora 13 and 14:

# service mongod status
mongod (pid 6403) is running...
# service mongod stop
Stopping mongod:                                           [  OK  ]
# service mongod start
Starting mongod: forked process: 7131
all output going to: /data/mongo/log/mongod.log
                                                               [  OK  ]

what is the output of " chkconfig | grep mongo " on your system?

if you don't get any output from the command above, then you still need to correctly configure mongod as a service with "chkconfig" (see 'man chkconfig')

e.g.:

chkconfig --add mongod
chkconfig --level 35 mongod on

afterwards you should get this output:

# chkconfig | grep mongo
mongod          0:off   1:off   2:off   3:on    4:off   5:on    6:off

# service mongod status
mongod (pid 6403) is running...


If process is not running but you still get this exeption - just delete "mongodb.lock" file in your mongodb/data folder

0

精彩评论

暂无评论...
验证码 换一张
取 消