Can't start mongodb several times when using start-stop-daemon?

I have always tested replication by running multiple processes mongodon the same server (because using multiple services is more expensive, and I'm just testing at this point).

However, since I upgraded mongo to version v2.0.5, I get the following when I try to run mongod again (on a different port, with a different 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 mongodas follows:

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

This does not happen when I run it like this:

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 start-stop-daemonfor use in my upstart script on Ubuntu 10.04 LTS. Why can this cause this problem?

manpage start-stop-daemon , , "". , start-stop-daemon, Upstart. , sudo, -?

+3
3

start-stop-daemon, .

start-stop-daemon, . script mainuser 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
0

: key -name-start-stop-daemon, . , node.js:

start-stop-daemon --name node-charts --start --exec /usr/bin/node -- someapp.js

start-stop-daemon --name node-web --start --exec /usr/bin/node -- someotherapp.js

- , /usr/bin/ node.

+1

This is because the pid file already exists for running mongod.

Just use another pid with start-stop-daemon. For instance,

sudo start-stop-daemon --start --pid=/var/run/mongodb2.pid --chuid mongodb --exec  /usr/bin/mongod -- --config /etc/mongodb2.conf

Therefore, he will not complain about "already running / usr / bin / mongod"

-1
source

All Articles