phpkode
phpkode

Reputation: 250

Cannot start mongodb after editing .conf file to add new Ip to bindIp

I have installed mongodb 2.6 in a ubuntu 14.02 server. To allow remote access I added the static Ip to /etc/mongod.conf

bindIp= 127.0.0.1, 192.168.0.150

I edited the file as root user using sudo command.

After this mongodb is not starting as service on boot up. But I can start it using following command :

sudo mongod --dbpath /var/lib/mongodb

As I understand I made some permission problem while editing conf file. I tried a few solutions including changing owner of /etc folder to mongodb as well as current system user. But they are not working. I am a very new user to linux environment. Any help would be much appreciated.

Edit:

Result of ls -l /etc/mongod.conf:

-rw-r--r-- 1 root root 1716 Aug 14 23:32 /etc/mongod.conf

Also the result for the command:

sudo service mongod start

is:

mongod start/running, process 2660. 

But if I try to open mongo client with mongo, I get

errno:111 connection refused, connection attempt failed at src/mongo/shell/mongo.js:146

Upvotes: 3

Views: 1835

Answers (1)

Danny Yao
Danny Yao

Reputation: 83

this line should be:
bindIp=[127.0.0.1,192.168.0.150]

Upvotes: 2

Related Questions