Backing up the Mid Tier cache


A cache is used for restoring the cache if the cache gets corrupt. You should 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 back 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.

To create a cache and back up the Mid Tier cache

  1. Install and set up Mid Tier on a computer outside of the Mid Tier cluster with no tenants added.
  2. Update the Cache Backup Directory folder path for the Mid Tier (for example /opt/bmc/ARSystem/midtier/backup.cache).
    1. Open the Mid Tier Configuration Tool.
    2. Click the Cache Settings link to open the Cache Settings page.
    3. Update the Cache Backup Directory folder path.
  3. (Optional) Perform this step after you have onboarding the first tenant.
    1. Stop the Mid Tier. 
    2. Copy the backup cache from shared location to backup folder of the Mid Tier.
    3. Delete all the content from the cache folder.
    4. Start the Mid Tier.
  4. Add a new tenant AR System server to the Mid Tier.
  5. Start the preload for the tenant AR System server.
  6. When the preload is complete, stop the Mid Tier.
  7. Back up the cache folder (as described below).
  8. Replace the backup cache that is stored at the shared location.
  9. Update the backup cache directory folder path for all the Mid Tiers in the cluster with the new backup cache directory folder path. 

To verify whether the cache is intact

  1. Stop Tomcat.
  2. Open the .lck file located in the midTierInstallationDirectory\cache directory.
  3. Verify whether the SHUTDOWN_COMPLETED state is available in the file.
  4. Restart Tomcat.

The cache is intact only if the SHUTDOWN_COMPLETED state is available.

To back up and restore the Mid Tier cache

  1. 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.

  2. 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.
  3. On the Cache Settings page, click Save Changes.
  4. (Linux) Stop Tomcat and use the backup utility to take a back up of the cache.
  5. Restart Tomcat and click Sync Cache to sync the cache for the AR System server.

To use the cache backup utility (Linux only)

Best practice

  • For Linux environments, we recommend that you use the cacheBackup utility so that you always get a good copy of the cache without a timestamp mismatch.
  • For Windows, you must manually back up the cache.
  1. Make sure that the Mid Tier is not running.
  2. Navigate to the Mid Tier root by using the following command:

    cd /opt/bmc/ARSystem/midtier/tools
  3. Assign execute permission to the cacheBackupUtility.sh file, as follows:
    chmod 755 cacheBackupUtility.sh
  4. Run the backup script and provide the backup directory name as the parameter.
    For example: /cacheBackupUtility.sh /opt/cache_backup/

To use a good copy of the cache

  1. Ensure that the target Mid Tier, on which you want to use good copy of the cache, is not running.
  2. 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
  3. Ensure that the path to the backup directory is set to /opt/cache_backup in the arsystem.ehcache.midTierBackupCacheDir property. 
  4. Go to the target Mid Tier and delete the midTierInstallationDirectory/cache directory.
  5. Start the Mid Tier which will automatically start using the good copy of the cache.

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*