Archive for June, 2009

Hot Backups and Database Verification Without Down Time

June 5th, 2009

By Wayne Blair, Senior Consulting Release Engineer and Development Facilitator

Hot backups are wonderful but one needs two important sanity checks on the backup:

  1. Was this a good backup?
  2. Is the live database okay or did we just backup a corrupted repository?

Unfortunately AccuRev v4.x cannot perform a database integrity check on the running repository so you have to schedule down time but you can run the “maintain” utility on your backup repository on a different machine with a minor change to the acserver.cnf file.

These steps can sanity check both your backup and your live repository at the time of backup without any down time using the behavior of the “maintain” utility.

  1. Write a backup mark using the command “accurev backup mark”.
  2. Replicate your entire accurev installation directory tree to another machine running the same operation system. You want the data, executables, configurations, and license key.
  3. Edit ./bin/acserver.cnf and change the machine name from your live repository to the name of the “other” machine”. MASTER_SERVER = your_other_machine.organization.domain
  4. Run the command “./bin/maintain dbcheck”.

If the command fails due to a host name error then review your edit for faulty white space (the white space before and after the = is required and you must not have trailing white space after the host name).  If the fully qualified name fails, try using the alias (short) name or IP address.

Assuming a successful dbcheck, you have now verified the integrity of your backup and you have verified the integrity of your live repository as of the time of the last backup mark command.

DETAILS

The AccuRev license is tied to a specific host and port number and you must have a different license file to run the AccuRev repository on a different machine.

The maintain utility performs a sanity check on the license and will exit when the license file is missing. It will check on the host name and will exit when the running host name does not match the host in acserver.cnf but will continue to perform the database integrity check when they do match!

My AccuRev server is Linux based so I run an hourly cron job to write the backup mark then rsync the whole installation to another machine.  I intentionally use the –delete option to ensure the backup is identical every time so the edits I apply to acserver.cnf will be eliminated the next time the backup is run.

Here is a trivial sample script to perform the backup with rsync.  I am writing this from memory so please verify the rsync syntax with the trailing slash on the directories.

# ASSUMPTION: ssh keys are already established between this host
#             and the remote host to allow an automatic login.
#
# NOTE: Be sure the previous run of this script has completed before
#       running again.

/opt/accurev/bin/accurev backup mark
sleep 3
rsync -az -e ssh --delete \
/opt/accurev/ \
wblair:/opt/accurev

About The Author

Wayne Blair was invited to contribute to our Distinguished Lecturer Series because of his experience as a consulting release engineer with multiple AccuRev customers.  Mr. Blair has extensive experience creating and extending software development, release, and installation environments, and helping communicate technical information to non-technical people.