Backing up OpenCms
For a complete backup of an OpenCms installation you will need to backup:
- Configuration files
- The the servlet container
- The OpenCms database
Configuring OpenCms properly for production use can be a tricky and time consuming. Make sure you adequately document the process particular to your hosting environment and make backups of any relevant configuration files (eg the Apache mod_proxy config, the Tomcat server.xml, etc).
Backing up the servlet container is a straight forward file system backup.
Backing up the database is more complex. This procedure is specific to each database product and version number.
OpenCms 6.x + MySQL 4.x on Linux
Normally the recommended way of backing up a MySQL database is to use the mysqldump command. This produces a SQL output which can then be restored using the mysql client. This, unfortunately, does not work with some large databases and with OpenCms in particular. A 'max_packet_length exceeded error' is reported during the restore operation. (I have no workaround for this problem that I've been able to get to work).
Instead use the mysqlhotcopy script which makes a safe copy of the underlying MySQL data files.
mysqlhotcopy --user=root opencms /var/tmp
To restore the backup simply place the directory which is created in the example above into the /var/lib/mysql directory. Make sure the correct file ownership and permissions are applied.
See http://dev.mysql.com/doc/refman/4.1/en/backup.html
Backing up using Database Export
It is also possible to backup an OpenCms site using the Administration -> Database Management -> Export Database tool. However there is a memory leak bug in OpenCms 6.0 in the import part of the process which can limit the size of the site which can be re-imported this way. (Is this fixed in 6.2.x?)