By andreaturri
I’m quite new with VPS and now I wish to publish a small project running with MEAN stack.
I wish to know best practices for MongoDB in production.
At the moment I just enabled authentication and changed the port, there is something more I should do?
I was also trying to understand how to do backups and if it is necessary (I think yes) but surfing I didn’t found any good tutorial that explain this.
Can you help me with that?
Cheers
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!
This tutorial will give you some good pointers for some general security measures to take with your server:
If you are allowing remote access to MongoDB, I’d also suggest implementing firewall rules that restrict what IP addresses are able to access it. The following would allow SSH access on port 22 and restrict incoming access to Mongo’s default port (27017) to a specific IP address:
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 to any port 27017
sudo ufw enable
This tutorial from the MongoDB docs should point you in the right direction for learning how to backup a MongoDB instance using the mongodump tool:
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.