Understanding storeBackup's Replication Wizard via an example

If you have done the Replication Wizard Quick Start, you probably do not need to go through this example in detail. This example is useful if your needs are atypical (which means the Replication Wizard Quick Start wasn't applicable) and you need to become familiar with the Replication Wizard. This example will help you to become familiar with the Replication Wizard quickly so you can move on to more advanced configurations.

The Replication Wizard creates three configuration files. This simple example will help you understand the files created by the Replication Wizard as well as how the Replication Wizard works.

The following command line example will demonstrate the Replication Wizard by taking you through a complete backup and replication using some temporary files.

To keep this example simple, we will be using the default series. For more information about backup series, have a look at Quick Start.

The files you will back up will be in /tmp/repliTest/localDisk/sourceFiles. The backup will be in /tmp/repliTest/externalDisk_1/masterBup. /tmp/repliTest/externalDisk_2/copyBup locates the replicated backup. Normally, the replicated backup would be on another disk such as a USB HDD or another server. That is the main way this example differs from what you would do in real life (the other ways it differs are: 1) we are backing up just a few example files, 2) we aren't using storeBackup.pl's main configuration file, and 3) we are not copying an existing backup to ``seed'' the replica.)

First, set up some temporary files to back up. The contents are not important. This is just an example.

mkdir -p /tmp/repliTest/localDisk/sourceFiles /tmp/repliTest/localDisk/deltaCache \
  /tmp/repliTest/externalDisk_1/masterBup /tmp/repliTest/externalDisk_2/copyBup
cd /tmp/repliTest/
cp /bin/ls /tmp/repliTest/localDisk/sourceFiles
touch /tmp/repliTest/localDisk/sourceFiles/test.txt
ls -la /tmp/repliTest/localDisk/sourceFiles

We assume storeBackup/bin is in your path. If not, create symbolic links as shown in section Super Quick Start. If needed, run these two commands (the 2nd line ends with: space,dot) in a terminal:

cd /usr/local/bin
ln -s /opt/storeBackup/bin/* .
cd -

Second, do the initial backup using the option lateLinks. This gives you something to replicate.

storeBackup.pl -s /tmp/repliTest/localDisk/sourceFiles/ \
  -b /tmp/repliTest/externalDisk_1/masterBup/ --lateLinks

You can expect one warning during the backup:

WARNING   2012.07.21 16:12:11 12580 created directory <backup//default>

Next, take a quick look at the Replication Wizard help:

storeBackupReplicationWizard.pl -h

Now run the Replication Wizard, telling it the location of the master backup, the deltaCache and the location to which you wish to replicate (copy) the master backup. None of those three directories is allowed to be a subdirectory of the others. And normally, the location for the copy (of the master backup) would be an external disk or another server. (The delta cache can be on the same disk where the source resides.) See section Basic concepts to know before using storeBackup's replication for more information.

storeBackupReplicationWizard.pl -m /tmp/repliTest/externalDisk_1/masterBup/ \
  -c /tmp/repliTest/externalDisk_2/copyBup/ -d /tmp/repliTest/localDisk/deltaCache

Because you didn't use the series name as an argument of option -S, you will be prompted as follows:

found series <default>
replicate it?

Answer yes to the prompt and the wizard completes (if you had specified the --series option, the wizard would not have prompted you).

At this point you could inspect the contents of the three replication-related configuration files, if you wish. (They are in /tmp/repliTest/externalDisk_1/masterBup, /tmp/repliTest/localDisk/deltaCache and /tmp/repliTest/externalDisk_2/copyBup with the extension .conf.) For example, see:

cat /tmp/repliTest/externalDisk_1/masterBup/storeBackupBaseTree.conf
cat /tmp/repliTest/localDisk/deltaCache/deltaCache.conf

You can also inspect the current files before your backup is replicated.

find /tmp/repliTest/ -print | sort

The last step is to finish the backup using storeBackupUpdateBackup.pl in the same way you normally would do that with the option lateLinks. By virtue of the configuration files the Replication Wizard has created, this step will now replicate (copy) your master backup to the replication location you have specified. Later, you can put the following two commands into a script and you probably set them up to run in a cron job.43

storeBackupUpdateBackup.pl -b /tmp/repliTest/externalDisk_1/masterBup/
storeBackupUpdateBackup.pl -b /tmp/repliTest/externalDisk_2/copyBup/

You can now inspect the files again and see that your backup was replicated (notice deltaCache/processedBackups too).

find /tmp/repliTest/ -print | sort

As we mentioned, storeBackup's Replication Wizard is an interactive program. If you wish to test this, use it with different options or try it with a broken environment. For example, try it with a non-existing master backup in an example similar to the above.

Heinz-Josef Claes 2014-04-20