Talk:Backup settings

From MoodleDocs

Jump to: navigation, search

I wonder if administrators should be recommended to use mysqlhotcopy rather than mysqldump. Although mysqldump outputs a handy SQL file, it does not lock tables before being called, so there is the potential for data inconsistency on large/busy sites. mysqlhotcopy locks tables before making copies of the table files themselves. These can be tarred & gzipped for copy to another disk/server:

#!/bin/sh
#
# clear moodle backup directory
rm -R /var/backups/databases/moodle/*
#
# hotcopy moodle tables
mysqlhotcopy --addtodest -u <username> -p <password> moodle /var/backups/databases
#
# tar & gzip them
tar -czf <path_to_homedir>/moodle-db-`date +%Y%m%d`.tar.gz /var/backups/databases/moodle
Personal tools
Moodle » Documentation » English