Backing up the mid tier cache
BMC recommends that you back up the mid tier cache in a separate directory. When the Tomcat server crashes or Windows explicitly stops the Tomcat service, that event causes an abrupt shutdown of the mid tier. When you restart the mid tier after an abrupt shutdown, the mid tier cache becomes corrupted or truncated. (A smooth shutdown leaves the mid tier cache intact.) If you have backed up your cache, you can avoid the time-consuming process of preloading the mid tier cache when the mid tier restarts. The mid tier restores the cache from the backup location only when the cache becomes corrupted.
The following topics are provided:
To verify whether the cache is intact
- Stop Tomcat.
- Open the .lck file located in the midTierInstallationDirectory\cache directory.
- Verify whether the SHUTDOWN_COMPLETED state is available in the file.
- Restart Tomcat.
The cache is intact only if the SHUTDOWN_COMPLETED state is available.
To back up and restore the mid tier cache
Create a directory in any location on the computer where the mid tier is running, and copy the intact cache to this location.
For example, copy the mid tier cache directory located in the midTierInstallationDirectory\cache folder to the /opt/cache_backup folder.
Ensure that you retain the timestamps of the data and index files. The backed up copy is not considered as a good copy if the timestamp does not match.
- On the Cache Settings page, in the Backup Directory field, enter the path and name of the directory that you created in the previous step.
- On the Cache Settings page, click Save Changes.
- (Linux) Stop Tomcat and use the backup utility to take a back up of the cache.
- Restart Tomcat and click Sync Cache to sync the cache for the AR System server.
Using the cache backup utility
Instead of manually copying the cache on Linux systems, use the cacheBackup utility to back up a cache and restore it for further use. The cacheBackup utility (cacheBackupUtility.sh) is a command-line utility available in the midTierInstallationDirectory/tools directory.
- This utility is available for Linux only. For Windows, you must manually back up the cache.
- BMC recommends that you use the cache backup utility so that you always get a good copy of the cache without a timestamp mismatch.
- Before running this utility, ensure that the mid tier is not running.
To use the cache backup utility
Navigate to the mid tier root by using the following command:
- Assign execute permission to the cacheBackupUtility.sh file, as follows:
chmod 755 cacheBackupUtility.sh
- Run the backup script and provide the backup directory name as the parameter.
Using good copy of the cache
- Ensure that the target mid tier, on which you want to use good copy of the cache, is not running.
Copy the /opt/cache_backup/cache.tar from the first mid tier to the target mid tier and extract it on the target mid tier. For example, use the following commands to copy and extract the .tar file:
To copy: scp /opt/cache_backup/cache.tar root@targetMidTier:/opt/cache_backup To extract on the target mid tier: cd /opt/cache_backup tar -xvf cache.tar
- Ensure that the path to the backup directory is set to /opt/cache_backup in the arsystem.ehcache.midTierBackupCacheDir property.
- Go to the target mid tier and delete the midTierInstallationDirectory/cache directory.
- Start the mid tier which will automatically start using the good copy of the cache.