How to backup your MySQL database & upload to Dropbox (cron job, code provided)

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Get Involved
Post Reply
shurijo
Registered User
Posts: 33
Joined: Sun Mar 15, 2015 8:37 pm

How to backup your MySQL database & upload to Dropbox (cron job, code provided)

Post by shurijo » Wed Aug 05, 2015 1:20 pm

Hey all,

I'm an admin (and coder) for a very active phpBB forum. Yesterday, my host's MySQL database server crashed and they had to restore their backups from the previous day. I was using the great phpBB "Auto Database Backup" extension written by pico88 (seriously, it's great, install it now), but that had just executed after they restored a 7 day old database, so the previous one was 24 hours old. My host's own backups was from earlier in the morning, which I had to use since it was the newest. In the end, we lost about 14 hours of posts, topics, etc. which just happen to be the most popular times of the day.

So I decided to write my own cron job to do hourly backups and store the files both locally on server and in DropBox for offsite storage. I posted instructions and source code on my personal blog in hopes that this doesn't happen to other forums like it did with us.

For speed/performance, our .SQL file created from the sqldump is around 500mb. Using gzip compression, it's around 130mb. The sqldump takes about 10 seconds, the gzipping/tar takes about 30 seconds. Not sure how long it takes for uploading to DropBox.

If you have any questions, just let me know here or post comments to the blog.

thanks,
~shurijo

Pond Life
Registered User
Posts: 388
Joined: Sat Jan 20, 2007 1:55 am

Re: How to backup your MySQL database & upload to Dropbox (cron job, code provided)

Post by Pond Life » Wed Aug 05, 2015 5:10 pm

If you had set the Stored backups: option to more than one it wouldn't have overwritten the only backup you had.
Never argue with idiots, they will drag you down to their level and beat you with experience.

shurijo
Registered User
Posts: 33
Joined: Sun Mar 15, 2015 8:37 pm

Re: How to backup your MySQL database & upload to Dropbox (cron job, code provided)

Post by shurijo » Wed Aug 05, 2015 5:27 pm

Pond Life wrote:If you had set the Stored backups: option to more than one it wouldn't have overwritten the only backup you had.
It was set and I did have 10 backups of the phpBB extension and 30 backups from the server host. I explained all that in more detail in the blog post. The problem is that it's a high traffic/volume forum and losing 15 or 20 hours worth of data is too much of a loss. So going back 15-20 hours to restore a day old backup means we lost a lot of data.

Post Reply

Return to “phpBB Discussion”