2013年7月20日星期六

Redmine 备份

You should arrange a regular backup of the Redmine database and the files that users upload/attach. The database can be dumped to a text file with:
/usr/bin/mysqldump -u root -p redmine_default | gzip > /path/to/backups/redmine_db_`date +%y_%m_%d`.gz
where is the one you set when installing mysql.
The attachments are stashed in /var/lib/redmine/default/files and can be backed up with something like:
rsync -a /var/lib/redmine/default/files /path/to/backups/files

上面是分别在 terminal 输入命令进行备份。
可以直接写一个备份 shell 脚本,将数据库和文件都备份(数据库会有密码,备份的是redmine_defualt库)。

You can have these commands run automatically by creating a script called /etc/cron.daily/redmine that contains:
#!/bin/sh
/usr/bin/mysqldump -u root -p redmine_default | gzip > /path/to/backups/redmine_db_`date +%y_%m_%d`.gz
rsync -a /var/lib/redmine/default/files /path/to/backups/files

Again, be sure to substitute the mysql root password for in the mysqldump command line. The file should be protected so that only root has read permission because you are storing the root password for your mysql installation in this file. That the first line creates a new file every time the script is run. This can eventually create a large number of backups of your database files. You should have a script that purges old ones periodically.

没有评论:

发表评论