By yazla
Hi there.
I want to connect to mongodb on droplet from another droplet. I have disabled firewall to get it out of equation.
I have set “bindIp” to the private ip of the droplet in mongodb.conf.
Now from another droplet, which also has private networking enabled I do mongo --host PRIVATE-IP
but doen’t connect, I am getting this is return:
connecting to: PRIVATE_IP:27017/test 2017-12-26T04:41:53.102-0500 Error: couldn’t connect to server PRIVATE_IP:27017 (PRIVATE_IP), connection attempt failed at src/mongo/shell/mongo.js:148 exception: connect failed
Can anyone please advice what I am doing wrong?
Thanks.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hi @yazla,
You can edit /etc/mongod.conf configuration file and make bind IP changed as below
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1,mongodb_server_private_ip
Once changes are made restart the mongod service.
service mongod restart
There is a recent Community question link below that was answered on how to access MongoDB from a remote machine you can feel free to check this out.
https://www.digitalocean.com/community/questions/how-can-i-access-mongodb-from-remote-system
I hope this helps!
Regards, Rajkishore
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.