I have two droplets and I want both of them to share the same MongoDB. Is it possible? I tried to get the MongoURL so I include it in both my meteor.js projects but I found no way to get it. I bet it’s quite easy.
I’d truly appreciate any help you can give me.
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!
In order to enable access over the internet, modify the value of bind_ip in /etc/mongod.conf By default, it is set to 127.0.0.1 which only allows local access. Changing the value to the IP address of your Droplet will allow external connections. Before doing so, please remember to review the MongoDB security checklist.
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1
You will need to restart MongoDB for the changes to take effect:
sudo service mongod restart
In addition to enabling one of the forms of authentication supported by MongoDB, setting up a firewall that only allows remote connections from specific IP addresses is a good security measure to implement. On Ubuntu, you can do this with UFW. The following commands will setup a basic firewall which will allow all outgoing connections from your server but only allow incoming connections via SSH or from the specified IP address (ip.address.to.allow) of your other server.
sudo apt-get install ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw allow from ip.address.to.allow
sudo ufw enable
Using your Droplet’s private IP address is also a good idea.
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.