1
votes

So I've got a virtual machine running on windows azure and installed mongoDB. However mongod works fine when I do: mongod --dbpath /mnt/datadrive/data but when I end the process and do mongo, I get:

2015-01-10T14:23:17.474+0000 warning: Failed to connect to 127.0.0.1:27017, reason: errno:111 Connection refused 2015-01-10T14:23:17.476+0000 Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146

I've edited the config /etc/mongod.config however when I try and run sudo service mongo start I get: Job for mongod.service failed. See 'systemctl status mongod.service' and 'journalctl -xn' for details.

What I'm initially trying to do is have mongoDB running as a service on my virtual machine so I can remotely can connect to it at anytime.

1

1 Answers

1
votes

When you typed in the mongod command, did you also give it a path? This is usually the issue. You don't have to bother with the conf file. simply type

mongod --dbpath="put your path to where you want it to save the working area for your database here!! without these silly quotations marks I may also add!"

example: mongod --dbpath=C:/Users/Kyle-3/Desktop/DEV/dangerzonearea/test/mongodb

That is my path and don't forget if on windows to flip the slashes forward if you copied it from the or it won't work!

Solution: Don't end the service. Let it continue while you use mongo from another cmd or shell.