High Quality JMS Messaging.

Backup

Since SwiftMQ release 4.5.0 it is possible to perform an online backup of the complete store during operation. A backup is done by intercepting a checkpoint. That is, a checkpoint is initiated and the backup is performed before transactions are restarted to get a consistent state of the store. During a backup operation, a save set is generated which includes all necessary files of the store. A save set has a timestamp and is generated below the backup directory. The number of generated save sets to keep is configurable and is maintained by the backup processor. A backup can be initiated manually via SwiftMQ Explorer / CLI or automatically through a backup job via the Scheduler Swiftlet.

Backup Configuration

The backup configuration takes place via the element "backup" of the Store Swiftlet. It contains 2 attributes. One is "path" and points per default to the directory "backup" below the router's store directory. This is the root path for backups. All save sets are created below that directory. The other attribute is "keep-generations" and specifies how many save sets should be keeped in the backup directory. The default is 3 generations. That is, if a new save set is created, the backup processor checks the number of save sets in the backup directory and deletes the oldest save set until the number of save sets matches the number, specified in attribute "keep-generations". If the value is changed, it will be automatically applied to the number of save sets. For example, if "keep-generations" is 4 and the number of save sets is also 4, and you change "keep-generations" to 2, the backup processor will automatically delete 2 save sets.

The following example uses an alternative backup path and specifies to keep 2 generations:

Example:

      <backup path="/usr/local/backup/swiftmq" keep-generations="2"/>

Performing a Backup via CLI

CLI provides a command "backup", available within context "/sys$store/backup". So you have to change to this context first. Thereafter, initiate the "backup" command:

Example:

      router1> cc /sys$store/backup
      router1/sys$store/backup> backup

      Backup initiated. Please watch Folder 'Generated Backup Save Sets'.

      router1/sys$store/backup>_

The backup runs asynchronously. Once it is finished, you'll find it below the "/sys$store/usage" context:

Example:

      router1/sys$store/backup> cc /sys$store/usage
      router1/sys$store/usage> lc

      Entity List: Generated Backup Save Sets
      Description: Generated Backup Save Sets

      Entities in this List:
      ----------------------
      saveset_20030217125000008
      saveset_20030220124842148
      saveset_20030220125000023

      router1/sys$store/usage>_

Performing a Backup via SwiftMQ Explorer

Go to the folder "Backup" of the Store Swiftlet, select it and do a right mouse click. A popup menu "Perform Backup Now" appears:

Click it and you'll see this message:

The backup operation is now performed asynchronously (during the next checkpoint). Once it is finished, you'll see a new entry in folder "Generated Backup Save Sets":

Schedule a Backup Job via the Scheduler Swiftlet

The Store Swiftlet registers a job "Backup" in job group "Store" at the Scheduler Swiftlet:

This job can be used to schedule a backup at a specific time of a day. The following example schedules the "Backup" job at 00:00, 10:00 and 18:00 on each business day:

Restore

To restore the content of a save set to the router's store, you have to stop the router. It is not possible to perform a restore while the router is running.

Thereafter you have to delete the following files from the router's store:

Now go to the backup root path (specified in the "path" directory) and select the save set you want to restore. Verify whether a file named ".completed" is contained in the save set. This file is created as the last operation during a backup, after all files are sync'ed with disk. If it is not contained, then the backup is incomplete, you cannot use it and you have to switch to the previous generation (just check the name of the save set which contains a time stamp).

From the save set, copy:

to the resp. router's store directories. Don't wonder why the file transaction.log isn't contained in the save set. It is just that the backup is performed right after a checkpoint when the transaction.log is empty and thus there is no need to save it.

Start the router.