Question

Block storage and MongoDB

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

Subscribe
Share

@lukaobuljen - How will you use the new block storage for your MongoDB: scaling, migrating, replication, or backup? Note that block storage is a bit slower than your typical SSD only droplets.


Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

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.