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.


Friday, August 19, 2011

ssh passwordless authentication ubuntu 10.04LTS server

setting up my mongodb test machine I'd like to ssh into it without using a password.
I followed this great tutorial: http://www.debian-administration.org/articles/152
however, I had to uncomment the AuthorizedKeysFile line on my mongodb test machine's /etc/ssh/sshd_config file. Now I can append authorized keys to this file for accessing the server.
While I'm there I'm also disabling root login.
Now I can follow along with the aforementioned tutorial and it works.
Now that I can login without a password I'm going back to /etc/ssh/sshd_config and adding the line:
PasswordAuthentication no

http://www.dd-wrt.com/wiki/index.php/Static_DHCP

Just installed dd-wrt onto my netgear WNDR3700 router - it was so easy!

Now to add static reservations to DHCP for the vmware MongoDB server I'm setting up for testing.