Migration is a subject unto itself and is not working all that hot for me at the moment, but backup and restore in a MySql innodb environment I might be of some help. I use http://www.percona.com/doc/percona-xtrabackup/ as it will do it hot without shutting it down. Find the one that matches your version.
Create a folder to hold your backups and an event to run your backup script every night from cron;
1# mkdir /usr/local/backups
2# echo "0 23 * * * /usr/local/backups/backup.sh >> /usr/local/backups/backup.log 2>&1" | crontab - -u mysql
In the /usr/local/backups directory create two scripts, this one to backup name it /usr/local/backups/backup.sh:
1#!/bin/bash
2USER=foo
3PASS=assword
4BACKUPDIR=/usr/local/backups
5SOCKET=/var/lib/mysql/mysql.sock
6RETENTION=7
7
8function error_exit {
9 echo "Problem - check logs"
10 touch $BACKUPDIR/FAIL
11}
12
13echo "**********************************************"
14echo "Start of backup"
15echo "**********************************************"
16innobackupex-1.5.1 --user=$USER --password=$PASS --socket=$SOCKET --stream=tar . | gzip -c -1 > $BACKUPDIR/backup.`date +%Y-%m-%d-%H-%M-%S`.tar.gz
17if [ $? != 0 ]; then
18 error_exit
19fi
20echo "Removing old files"
21find $BACKUPDIR -mtime +$RETENTION -name "*.gz" -print -exec rm {} \;
22if [ $? != 0 ]; then
23 error_exit
24fi
25echo "**********************************************"
26echo "End of Backup"
27echo "**********************************************"
this one to restore, name it /usr/local/backups/restore.sh; NOTE: this wipes out and restores the entire database, assumes you have nothing but your portal on it.
1#!/bin/bash
2# restore.sh - restore an xtrabackup tar.gz file
3USER=foo
4PASS=assword
5function usage
6{
7 cat << EOF
8
9Restore an xtrabackup tar.gz file and replace a mysql database.
10
11usage: $0 options
12
13OPTIONS:
14 -b Name of the tarred and gzipped database backup to restore
15 -h Show this message
16
17EOF
18}
19TARFILE=
20while getopts "b:h?" OPTION
21do
22 case $OPTION in
23 b)
24 TARFILE=$OPTARG
25 ;;
26 h)
27 usage
28 exit 1
29 ;;
30 ?)
31 usage
32 exit 1
33 ;;
34 esac
35done
36if [[ -z $TARFILE ]]; then
37 usage
38 exit 1
39fi
40echo Beginning restoration of $TARFILE ...
41BACKUPDIR=/usr/local/backups/${TARFILE%.tar.gz}
42if [[ -e $BACKUPDIR ]]; then
43 echo removing directory from prior run
44 rm -rf $BACKUPDIR
45fi
46mkdir -p $BACKUPDIR
47tar xifz $TARFILE -C $BACKUPDIR
48innobackupex-1.5.1 --user=$USER --password=$PASS --apply-log $BACKUPDIR
49/etc/rc.d/init.d/mysqld stop
50rm -rf /var/lib/mysql/*
51innobackupex-1.5.1 --copy-back $BACKUPDIR
52chown -R mysql:mysql /var/lib/mysql
53/etc/rc.d/init.d/mysqld start
54echo Restoration of $TARFILE complete.
55rm -rf $BACKUPDIR
Now you have scheduled backups that will keep a weeks worth of snapshots and clean out the old on your database, just add a sister event on your portal server to tar up at least the data directory of liferay or more depending on how much you change it at about the same time and you're good to go. Just check the timestamps and restore them as a pair.
Bitte melden Sie sich an, um diesen Inhalt als unangebracht zu kennzeichnen.