2

When I run "/usr/bin/mongod --config /var/data/rs1/rs1db0v3.conf". It failes. The error is:

warning: bind_ip of 0.0.0.0 is unnecessary; listens on all ips by default about to fork child process, waiting until server is ready for connections. forked process: 16970 ERROR: child process failed, exited with error number 1

The permission of the relative files and folds are following:

drwxr-xr-x 6 root root 115 Mar 16 14:47 .

drwxr-xr-x 5 root root 43 Jan 20 12:12 ..

drwxr-xr-x 6 mongodb mongodb 4096 Mar 16 15:05 db

drwxr-xr-x 2 root root 28 Jan 20 10:04 keys

drwxr-xr-x 2 mongodb mongodb 23 Jan 20 10:32 log

-rwxr-xr-x 1 mongodb mongodb 593 Mar 16 14:47 rs1db0v3.conf

-rwxr-xr-x 1 mongodb mongodb 21303832 Mar 3 08:03 /usr/bin/mongod

I found similar questions in this website, but no answers can help me...

-----SOLVED-----

I have no idea how to run mongod as mongodb, so I changed the ownership to user1, and then run mongod as user1. It works.

drwxr-xr-x 6 root root 115 Mar 16 14:47 .

drwxr-xr-x 5 root root 43 Jan 20 12:12 ..

drwxr-xr-x 6 user1 mongodb 4096 Mar 16 15:05 db

drwxr-xr-x 2 root root 28 Jan 20 10:04 keys

drwxr-xr-x 2 user1 mongodb 23 Jan 20 10:32 log

-rwxr-xr-x 1 user1 mongodb 593 Mar 16 14:47 rs1db0v3.conf

-rwxr-xr-x 1 user1 mongodb 21303832 Mar 3 08:03 /usr/bin/mongod

1 Answer 1

1

First of all when you run mongod as a normal user you need to make sure that the particular user has the following permissions:

  1. Access to network interface ( open socket ) in order to be able to listen to connections
  2. Access to the database folder. The default is accessible only by root or mongod user (/data/db)
  3. Access to logging folder /var/log/mongod

All of the above are automatically set and granted for the user mongodb (mongod in earlier versions). If you take a look at /etc/init.d/mongodb you will see that the service will be stared under the user mongodb DAEMONUSER=${DAEMONUSER:-mongodb} and not as root.

2
  • I checked the /etc/init.d/mongod, in it there are no USER information. I already upgraded the mongodb to 3.0.0 following the steps in [link] docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu ------- FYI, I used chown to change the permission of log/ and data/ folds to mongodb:nmongodb. But it fails to run without sudo.... How can I check whether mongodb has the permission to netword interface.
    – BAE
    Commented Mar 17, 2015 at 13:24
  • In /etc/passwd, mongodb:x:107:65534::/home/mongodb:/bin/false
    – BAE
    Commented Mar 17, 2015 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.