• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 WHM Backups

#1
I've been doing quite a bit of searching on the XF community forums about this but I haven't been able to find much info.

I think I need to set something up so that I can start to get daily backups of my site files and forum database.

At first, I was thinking maybe I could set up a cron job in cPanel to do this, but then my host informed me that I could do this inside WHM.

Are WHM backups a good way to go about doing daily backups? I wonder, what if changes to the database are being made while the WHM backup is running? How do busy boards handle backups? For example, what if a post is made or people are signing up at the exact same time the backup is being made inside WHM? Wouldn't this possibly lead to an incomplete (or corrupt) backup?

I think I read that programs like mysqldump actually disable changes to the database while the info is being exported. I've also heard of people turning off their forum until the backup is finished. But these relate to manual backups. I'm asking about automatic backups.

What's the worst case scneario in the event I'd need to restore a backup file that was made during database changes? Would the user simply need to re-post the thread/sign up again, or would the database be corrupt?
 

AndyB

Well-known member
#2
Your best bet is to use mysqldump and set it up in cPanel Cron Jobs. I have 7 cron jobs one for each day of the week.
 
#3
If you use options --single-transaction --quick in your mysqldump, your Users won´t get a locked database.
About wich Size of the Database and Files are you talking?

For Example i do backup my Files and Databases automatic every Day at 3am with a Backupscript called via Cronjob.
Full Backup need half Hour, Databasebackup around 3-4 Minutes. Filesize is 40GB and DB-Size 2GB after the Backup
is finish it transfer to a FTP-Server.

You should think about external Data-Backup too. What is if your Harddisk crashed or something else happen with your Host?
 

Brogan

XenForo moderator
Staff member
#4
This is what I use.

Code:
mysqldump -u{user} -p{password} --single-transaction --skip-lock-tables {database} > /path/to/backup/{file-name}_$(date +%d.%m.%y).sql
Replace everything in the { } with your own details.
 
#5
Thanks, everybody.

Your best bet is to use mysqldump and set it up in cPanel Cron Jobs. I have 7 cron jobs one for each day of the week.
Do you know of a guide where I could go about setting something like this up? I've already seen documentation on how to use mysqldump manually, but as I mentioned, I'm looking for something automatic, like a cron job.

If you use options --single-transaction --quick in your mysqldump, your Users won´t get a locked database. About wich Size of the Database and Files are you talking?
My forum is brand new. I'm just (finally) starting to show up in search engines. I've made all the posts so far (about 1500) myself. Total site (files and Dbase) is only about 40mb compressed. Even though it's all my own posts, it represents about 2 years worth of work and I sure don't want to lose any of it.

This is what I use.

Code:
mysqldump -u{user} -p{password} --single-transaction --skip-lock-tables {database} > /path/to/backup/{file-name}_$(date +%d.%m.%y).sql
Replace everything in the { } with your own details.
Thanks for the info, but I need some reference for this. Is this the command you're using inside mysqldump? Do you make manual backups or do you have a way of automating them?
____________

NOTE: I want to add that my forum got hacked a few months ago. I had a developer check my backup copy and he wasn't able to find any malicious code anywhere in my XF forum software. However, the hacker did change my home page. I completely wiped the server and restored a backup I confirmed to be clean. But since then, I've locked things down with a ludicrous amount of security. I have 2 factor auth on all my forum admin accounts, plus WHM and cPanel is locked down with 2 factor. On top of that, I'm using my host's firewall above WHM and cPanel to disallow access to SSH, FTP, cPanel and WHM. I'd like to keep all of this closed off via firewall, if possible AND ideally, I'd like to somehow make daily automatic backups of everything, saved directly to my local machine.

If someone knows of some kind of solution or guide for setting something like this up, I'd greatly appreciate it.