Does mongo *really* need a dedicated volume, if I need to back it up? TLDR; What's the easiest way to automate a mongodb backup of a 20-gig DB?
We run mongo on the same KVM (VPS) as the web app; the server runs Debian.
We/I don't need/want to backup the entire fs on a daily basis, but definitely the Mongodb database.
I don't really want to put Mongo in a separate volume, it complicates things and increases likelihood of downtime, especially when I need to expand the volume in question. However, using the LVM to create snapshots seems like the easiest (actually, the only) way forward.
I've been told that when oplog is in use hot snapshots won't be corrupt.
I found this guide demonstrating how to set up this backup method, but it's almost 10-years out of date. Is there an easier way?
I have read everything I could find, several times, on the man-pages.
Thanks for reading :)
Yes, hot snapshot is easy and fast way to do backup... But of course there is also mongodump. Here is my crontab entry. Every hour, overriding current date backup.
SHELL=/bin/bash
DATEVAR=date +%d
    
31 * * * * /usr/bin/mongodump --host localhost -o /dbdata/dump$($DATEVAR) --gzip --oplog &gt;&gt; /dev/null 2&gt;&amp;1