I've always been testing replicasets by starting multiple mongod
processes on the same server (because using multiple serves is more expensive, and I'm merely testing at this point).
However, since I've updated mongo to version v2.0.5 I'm getting the following when I try to start mongod again (on another port, with another database folder, etc.):
mongod already running
Why is this so? Is there a flag to skip this check?
Update: for some reason this only happens when I run mongod
like so:
sudo start-stop-daemon --start -c mainuser --exec /usr/local/bin/mongod -- --journal --nohttpinterface --dbpath /home/mainuser/data/db-secondary --logpath /home/mainuser/data/logs/mongodb-secondary.log --logappend --replSet appname --port 30001
It does not happen when I run it like so:
sudo /usr/local/bin/mongod --journal --nohttpinterface --dbpath /home/mainuser/data/db-secondary --logpath /home/mainuser/data/logs/mongodb-secondary.log --logappend --replSet appname --port 30001
Unfortunately I have to use the start-stop-daemon
for use in my upstart script on Ubuntu 10.04 LTS. Why would it cause this issue?
After reading the manpage for start-stop-daemon
it becomes clear that it is purposely not trying to start the process again because it recognizes it as being the same "service". However, I'm only using start-stop-daemon
so that I can run as a different user with Upstart. Is it possible to bypass the check, or run as a non-sudo user in upstart in a different way?
This turned out to be a feature of start-stop-daemon
, which I used with upstart to run as another user.
By not using start-stop-daemon
, this issue was resolved. Inside my upstart script, I now run as mainuser using sudo
:
sudo -u mainuser /usr/local/bin/mongod --journal --nohttpinterface --dbpath /home/mainuser/data/db-secondary --logpath /home/mainuser/data/logs/mongodb-secondary.log --logappend --replSet appname --port 30001