Hello, can someone explain or point me to some solution of how to use MongoDB and new Block Storages. I have existing MongoDB database and I want to enable it to store data on new created and mounted Blocks. Is that even possible and how can be done? 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!
That is possible and one method of doing this is:
First stop mongodb
sudo service mongodb stop
Move your database to block storage. (Depending on the version, your database may be in a different location. Check your MongoDB config file for dbpath option.)
sudo mv /usr/local/var/mongodb /block/storage/mongodb/
Create a symlink to the new part of the database. (Depending on the version, your database may be in a different location. Check your MongoDB config file for dbpath option. )
sudo ln -s /block/storage/mongodb/ /var/lib/mongodb
Setting permissions
sudo chown mongodb:mongodb /block/storage/mongodb/
Start MongoDB sudo service mongodb start
This is one method of doing it, you can also edit your MongoDB config file and set the dbpath option to block storage.
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.