The backup can be done while the sever is running. For restoring, the server must be stopped first.
Backup with mysqldunp:
mysqldump -u root -p <password> -h localhost --skip-lock-tables --single-transaction --databases zarafa > zarafa.dump.sql
Restore with mysql
mysql -u root -p <password> zarafa < zarafa.dump.sql
Sometimes the dump was created with chunks bigger then the server accepts:
ERROR 1153 (08S01) at line 6734: Got a packet bigger than ‘max_allowed_packet’ bytes
Then open a terminal with mysql -u root
and enter the following
mysql -u root
set global net_buffer_length=1000000;
set global max_allowed_packet=1000000000;
Leave the terminal open, and use the following in a new terminal:
mysql -u root -p <password> --max_allowed_packet=100M zarafa < zarafa.dump.sql
Don’t forget the attachments, since they are saved separately. Backup with:
tar -zcvf zarafa_attachment.tar.gz /var/lib/zarafa/
And restore the attachments with:
tar -zxvf zarafa_attachement.tar.gz rm -rf /var/lib/zarafa/* mv var/lib/zarafa/* /var/lib/zarafa chown -R zarafa:zarafa /var/lib/zarafa