demand analysis
From deleting the library to running away, everyone has heard a lot, but if the backup is not deleted, it can only be said that the game is not thorough enough and unprofessional. A very important responsibility of the ZenTao system administrator is to regularly back up ZenTao so that it can be restored in time in the event of a system failure. Let's take a look at how to back up the ZenTao system.
Zen Tao's backup is divided into four parts: configuration files, modified code, database and attachments. Let's look at the backup methods in different environments. .
The overall backup strategy includes five parts: backup objects, determination of backup frequency and backup method, formulation of backup set storage strategy and recovery management.
1. Manual backup
-
Backup of configuration files, codes and attachments
- The configuration file is stored in zentao/config/my.php The
attachment is stored in the zentao/www/data/ directory.
The modified code is also placed under the zentao directory.
So the way to back up configuration files, code and attachments is to back up the entire zentao directory.
- The configuration file is stored in zentao/config/my.php The
-
database backup
- Directly back up the database original files.
- Find the data directory of mysql. Windows is generally under the mysql installation directory. Linux is generally under a directory like /var/mysql or /var/db. Under the data directory, there will be a zentao directory. This zentao directory is the original database file. It is also possible to copy this directly. Under linux, you may need to pay attention to the problem of permissions.
- By exporting the backup file.
- You can use the management tool provided by mysql to export the database: mysqldump -u xxx -p zentao > zentao.sql, where the user is replaced by the actual user.
- Directly back up the database original files.
Log in to Zendao backend for backup
You can open scheduled tasks in the background - scheduled tasks to automatically back up data and attachments.
In the Scheduled Tasks list, you can edit the time and frequency of backup tasks.
Backup using backup scripts
- First we have to initialize the management script
- Execute backup.sh under linux
- After the backup is successful, the database files and attachments are saved in the zentao/backup directory with the names of the dates.
cd /opt/zbox/app/zentao/bin
./backup.sh
Warning: Creating default object from empty value in /opt/zbox/app/zentao/config/config.php on line 19
Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; PclZip has a deprecated constructor in /opt/zbox/app/zentao/lib/pclzip/pclzip.class.php on line 190
Backuping database, successfully saved to /opt/zbox/app/zentao/backup/201804/db.20180426.zip
Backuping files, successfully saved to /opt/zbox/app/zentao/backup/201804/file.20180426.zip
How to restore
Manually back up files for recovery
201504241639265.file.zip.php This file is renamed first and the last .php is deleted, then decompress and put the obtained file under www/data/upload/1/ of Zen Tao;
201504241639265.sql.php This file is renamed first and the last .php is deleted. It is a sql file, which can be directly imported into an empty library in mysql, and then modify the connection to Zen Tao in zentao/config/my.php The database information can be connected to this new library.
error resolution
View logs
Change the value of debug in zentao/config/my.php to true, click the backup button in the background-backup, and see what is wrong with the log file (today's file at the beginning of /opt/zbox/app/zentao//tmp/log/php) .
Adjust memory limit
Modify the memory_limit value in /opt/zbox/etc/php/php.ini to 512M (if the prompt is small, continue to increase it according to the server situation)
restart the service
Determine backup strategy
directory mount
mount -t cifs -o username="zentao",password="wyygdjbdjb" //192.168.1.12/zentao /opt/zbox/app/zentao/backup/
backup strategy
serial number | Department | server nickname | Backup object | IP/Hosts | Backup frequency | Backup method | backup set | manage | backup script | recovery measures |
---|---|---|---|---|---|---|---|---|---|---|
1 | Quality Management | Zen Way | Zen Tao Backup File | 192.168.1. | 3 days/time full preparation | script | \\ 192.168.1.12 \ zentao | restore/delete | /opt/zbox/app/zentao/bin | See manual recovery above |