Last year while I was working in a project, I needed to automate thewhole backing up process from taking snapshot of the current db to saving it to AWS S3 buckets. At that time I took most of the staffs from this blog post.
Couple of days ago, I started to code for making small backup scriptthat will backup to another cloud machine rather than to AWS S3. Instead of coding it from scratch, I reused my previously coded script. All I need to implement a bash function(save_in_cloud) which runs a simple scp command
The whole script look like below:
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
|
I reused this script, all I did just added a new function which copy the current backup data to a remote server. And also updated do_cleanup, now it works in any year.
The backup script depends on other two js (fsync_lock.js andfsync_unlock.js) functions which responsible for locking mongo during db snapshots and releasing lock after the snapshots.
2 comments:
Thanks for the explanation. Assuming that my application is connected to the primary server ip and this fall. How to make my application to connect transparently secondary? Hesitate to shake this one? after all, the IP changed. Thank you.
Thanks for sharing valuable information on MongoDB backup script. It makes MongoDB backup easy.
Post a Comment