CRX Online Backup
Question / Problem
How do I make an online backup for CRX 1.4.1 or 1.4.2?
Answer / Resolution
See Online Backup for details.
Make sure you have the following JVM parameter:
Using a Different Source Directory
The documentation above assumes the default CRX/CQ installation is used (using the Standalone or Quickstart). When using a different configuration, the backup source directory may not match. In this case, the source directory needs to be set in the URL when creating the backup. The URL parameter for the backup source directory is 'installDir' . Example:
- Create a new backup (The command (curl) returns when the backup is completed on the server).
curl -b login.txt -f -o progress.txt -d "action=add&zipFileName=backup.zip&installDir=/cq/data" "http://localhost:7402/crx/config/backup.jsp"
If the shared directory should also be included in the backup (usually yes, as it contains the data store), then the shared directory needs to be a subdirectory of the backup source directory (installDir). This is the case in the default installation. If this is not the case, one solution is to create a soft link to the shared directory within the backup source directory.
Using a Different Target Directory
The backup tool creates the backup zip file is always created in the directory <repository/../../..>, which may not be the parent directory of the backup source directory. Make sure CRX has write access to this folder. When using a different application server (such as JBoss), the online backup may not work as expected, because the target directory is not writable. In this case, please ask Day support for a hotfix or patched backup.jsp file.
curl -b login.txt -f -o progress.txt "http://localhost:4502/crx/config/backup.jsp?action=add&zipFileName=backup.zip&targetDir=/Cq5/cq5"
To directly write in the folder (not in a zip file):
curl -b login.txt -f -o progress.txt "http://localhost:4502/crx/config/backup.jsp?action=add&zipFileName=&targetDir=/Cq5/cq5"
Make sure the targetDir is always cleared before you do a new backup as it can produce unexpected error it old files are present in that directory.
CRX2.x: simply add a parameter
targetDir to the
curl request, specifying the target path where to store the backup.
Duplicating a Repository
CRX 1.4.x only: If the backup is restored and CRX / CQ is started while the first (original) repository is still running, and if there is a TCP/IP connection between the original repository and the restored (new) repository, then an exception will be thrown. To resolve this problem, delete all files **/listener.properties and cluster_node.id in the restored repository before starting.
The online backup uses the following algorithm currently:
- When creating a zip file, then first a temporary directory is created. This directory starts with "backup." and ends with ".temp".
- All files are copied from the source directory to the target directory (or temporary directory when creating a zip file). The progress bar indicator of this sub-process is between 0% - 70% when creating a zip file, or 0% - 100% if no zip file is created.
- If no zip file is created, then the specially named file "backupInProgress.txt" is created in the target directory (this marker file is deleted when the backup is complete).
- If no zip file is created, then the old files in the target directory are deleted. Old files are files that don't exist in the source directory.
- The files are copied to the target directory in four stages.
- In the first copy stage (progress indicator 0% - 63% when creating a zip file or 0% - 90% if no zip file is created), all files are copied concurrently while the repository is running normally.
- In the second copy stage (progress indicator 63% - 66.5% when creating a zip file or 90% - 95% if no zip file is created) only files are copied that were created or modified in the source directory since the first copy stage was started. Depending on the activity of the repository, this may be no files at all, or a medium number of files (because the first file copy stage usually takes a lot of time).
- In the third copy stage (progress indicator 66.5% - 68.6% when creating a zip file or 95% - 98% if no zip file is created) only files are copied that were created or modified in the source directory since the second copy stage was started. Depending on the activity of the repository, this are no files at all, or a very small number of files (because the second file copy stage usually is fast).
- File copy stages one to three are all done concurrently while the repository is running. The fourth and last file copy stage will first lock repository write operations (write operations are paused; they don't throw an exception, but they wait). Only files are copied that were created or modified in the source directory since the third copy stage was started. Depending on the activity of the repository, this are no files at all, or a very very small number of files (because the second file copy stage usually is very fast). After that, repository access continues. Progress indicator 68.6% - 70% when creating a zip file or 98% - 100% if no zip file is created.
- If a zip file is created, this is done now using the temporary directory. Progress indicator 70% - 100%. The temporary directory is then deleted.
Please note this algorithm may change in future versions without notice.
CRX 1.4.1 and 1.4.2, CRX 2.x