5

I'm starting my mongod with the following command:

mongod --port 27017 --dbpath /var/lib/mongodb/ --replSet rs0

It works fine and I can configure the replica set. When I try to to launch mongod with service mongod start command it fails with the following error:

Starting database mongod [fail]

I have no error in var/log/mongodb/mongodb.log, /var/log/syslog or /var/log/syslog.1.

I found this work-around solution to run as mongod as a service:

mongod --port 27017 --dbpath /var/lib/mongodb/ --replSet rs0 --fork --logpath /var/log/mongodb/mongodb.log or mongod --config /etc/mongod.conf

I'm running on mongodb 2.6. rs.initiate() worked fine.

I added fork = true and replSet = rs0 in my /etc/mongod.conf.

How can I start MongoDB by using service mongod start?

4

0 回答 0