Run
Run

Reputation: 57286

Mongoose - remote database connect failed

I am trying to connect to my mongo database in my remote server:

$ mongo xxx.xxx.xxx.xx:27017

But I get this error:

MongoDB shell version: 2.6.10 connecting to: xxx.xxx.xxx.xx:27017/test 2016-11-07T05:18:39.140+0000 warning: Failed to connect to xxx.xxx.xxx.xx:27017, reason: errno:111 Connection refused 2016-11-07T05:18:39.142+0000 Error: couldn't connect to server xxx.xxx.xxx.xx:27017 (xxx.xxx.xxx.xx), connection attempt failed at src/mongo/shell/mongo.js:148 exception: connect failed

Any ideas why?

I even have tried to connect it with an username and password but it still fails to connect...

Upvotes: 0

Views: 547

Answers (1)

vipul Gupta
vipul Gupta

Reputation: 11

Run this following command :

sudo service mongodb stop
sudo rm /var/lib/mongodb/mongod.lock
sudo service mongod restart
mongo

Upvotes: 1

Related Questions