Ubuntu: mongodb won’t start [FIXED]

So you decided to change the default location of your mongodb data path on mongodb.conf but mongo won’t start and you get an error similar to this

[bash]
Wed May 23 04:17:35 [initandlisten] MongoDB starting : pid=1214 port=27017 dbpath=/media/ebs/data 64-bit host=domU-12-31-38-00-78-DB
Wed May 23 04:17:35 [initandlisten] db version v2.0.4, pdfile version 4.5
Wed May 23 04:17:35 [initandlisten] git version: nogitversion
Wed May 23 04:17:35 [initandlisten] build info: Linux yellow 2.6.24-29-server #1 SMP Tue Oct 11 15:57:27 UTC 2011 x86_64 BOOST_LIB_VERSION=1_46_1
Wed May 23 04:17:35 [initandlisten] options: { bind_ip: "127.0.0.1", config: "/etc/mongodb.conf", dbpath: "/media/ebs/data", logappend: "true", logpath: "/var/log/mongodb/mongodb.log", port: 27017 }
Wed May 23 04:17:36 [initandlisten] journal dir=/media/ebs/data/journal
Wed May 23 04:17:36 [initandlisten] recover : no journal files present, no recovery needed
Wed May 23 04:17:36 [initandlisten] waiting for connections on port 27017
Wed May 23 04:17:36 [websvr] admin web console waiting for connections on port 28017
Wed May 23 04:17:38 [initandlisten] connection accepted from 127.0.0.1:46843 #1
Wed May 23 04:17:40 [conn1] end connection 127.0.0.1:46843
Wed May 23 04:18:36 [clientcursormon] mem (MB) res:15 virt:624 mapped:0
Wed May 23 04:19:39 got kill or ctrl c or hup signal 15 (Terminated), will terminate after current cmd ends
Wed May 23 04:19:39 [interruptThread] now exiting
[/bash]

Just make sure the ownership of the directory is the same as the user ubuntu tries to start mongodb with (it’s not root, even if you’re doing sudo service mongodb start, it’s “mongodb”)

Extra points for whoever tells me how the hell to change the default user to something else.
Ubuntu/Mongo’s documentation says that for upstart based systems you can do this at /etc/init.d/mongodb.conf, but such file doesn’t exist for Ubuntu 12.04.

hope this helps

One thought on “Ubuntu: mongodb won’t start [FIXED]

  1. The correct location to modify your upstart script in ubuntu is /etc/init/mongodb.conf

    Had to find it so that I could set up a replica set. In there you should be able to then launch mongo with another user.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.