Monday, August 22, 2011

mongodb not starting automatically

Noticed that my mongoDB isn't automatically starting when I boot like I think it used to.   I'm able to start it with ./mongod, but what happened?  I forced it to shut down the other day without logging in and ./halt...Surfing the web I find:
http://www.cleverkoala.com/2010/08/mongodb-upstart-service-wont-start-on-ubuntu/
yeah, what's this upstart system, anyway?
Ok, let's try, as cleverkoala.com tries:
./mongod --repair.
and promise to read http://www.mongodb.org/display/DOCS/Durability+and+Repair
Will this fix everything?
No - nice to know about such a promising sounding command ./mongod --repair
maybe there's a ./upstart --repair? or man upstart?
Wow! there is a man upstart!


init(8)                                                                init(8)

NAME
       init - Upstart process management daemon

SYNOPSIS
       init [OPTION]...

DESCRIPTION
       init  is  the  parent of all processes on the system, it is executed by
       the kernel and is responsible for starting all other processes;  it  is
       the  parent  of all processes whose natural parents have died and it is
       responsible for reaping those when they die.

       Processes managed by init are known as jobs and are defined by files in
       the  /etc/init  directory,  unless overridden (see below).  See init(5)
       for more details on configuring Upstart.
...............................................................................................................................

Ok, time to look at my /etc/init/mongodb.conf file, which is supposed to be the file that defines upstart jobs:

................................................................................................................................

# Ubuntu upstart file at /etc/init/mongodb.conf

limit nofile 20000 20000

kill timeout 300 # wait 300s between SIGTERM and SIGKILL.

pre-start script
    mkdir -p /var/lib/mongodb/
    mkdir -p /var/log/mongodb/
end script

start on runlevel [2345]
stop on runlevel [06]

script
  ENABLE_MONGODB="yes"
  if [ -f /etc/default/mongodb ]; then . /etc/default/mongodb; fi
  if [ "x$ENABLE_MONGODB" = "xyes" ]; then exec start-stop-daemon --start --quiet --chuid mongodb --exec  /usr/bin/mongod -- --config /etc/mongodb.conf; fi
end script
..........................................................................................................................

to decipher, and looks ok to me.  At a loss as to why it's not running automatically at boot, so maybe it's time to start with a fresh install.


No comments:

Post a Comment