Knowledge Base


Knowledge Base / XFilesharing Pro / How to ...

Backing up XFileSharingPro

09/09/2015 02:49 PM
Question
I'm looking for a way to setup the backups system on my site. What exactly shall I do?

Answer

XFileSharing uses both file system and MySQL Database to store the sensitive data on the main server, and only the file system on additional file servers. The places where the data is getting stored in the file system are the contents of cgi-bin/ and html/ directories (you can find the absolute paths in XFileConfig.pm and XFSConfig.pm). The place where the data getting stored in the database is a single MySQL database which credentials are specified in XFileConfig.pm (the fields width db_ prefix).

We suggest you to use mysqldump to save the contents of MySQL database on the disk, and RSync to transfer the files along with the saved MySQL dump in a safe place. So generally, the backup process should be looking as follows in UNIX Shell:

mysqldump -u$db_login -p$db_pass $db_name> --hostname=$db_host --ignore-table=$db_name.IP2Files >$cgi_dir
rsync --progress -ave ssh $cgi_dir [email protected]$external_host:/backup/cgi/
rsync --progress -ave ssh $html_dir [email protected]$external_host:/backup/html/

(don't forget to replace the values prepended with '$' with the actual values found in config).

In addition to that, it's highly suggested to ensure that your backing processes are conforming with the following guidelines:

* There are two categories of the system administrators - the ones that are not doing the backups yet, and the ones who are doing already because they recently had a data crash
* Making backups without a really good testing is the same thing as not making them at all
* Storing the backup on the same server is risky. It's better if we could put them on another datacenter of another provider.

Setting up the continuous backing system

After you're done, you might want to put the two commands above in a BASH script, and make it running each day with cron. You have to note though that in this case it's really important to manually test that this system still produces the working backups as least once a week, as otherwise you might find it completely broken when a crash occurs.