Using Full Hot Copy
A full hot copy creates a transactionally-consistent copy of an SM’s archive at the time the hotcopy finishes.
This copy includes every storage group that SM serves (note, this may not be every storage group in the database).
Use the --backup-dirs
option to coordinate hot copies across multiple SMs to ensure that every storage group is included in a hot copy when using table partitions and storage groups.
Even if you are not explicitly using storage groups, all data is stored in the default storage group which is maintained by every SM, so coordinated hot copy is not required.
A full hot copy of an SM is approximately the same size as the archive of the SM being hot copied at the time the hot copy finishes, plus the size of the journal of the SM at the time the hot copy finishes.
Using Full Hot Copy
To request a full hot copy, specify --type full
when executing the hot copy:
nuocmd hotcopy database --db-name <dbname> --type full --backup-dirs <archive-id> <backup-set-location>
A full hot copy must create a new (empty) backup set. This means that any directory specified by the command must either be empty or must not yet exist.
Restore From a Full Hot Copy
A full hot copy to a backup set can only be restored into a new archive using nuoarchive
.
This will extract the full hot copy from the backup set and copy it to a new archive directory.
Once restored, the archive can be used to start an SM.
NuoDB Archive options relevant to restoring a full hot copy from a backup set:
nuoarchive restore --restore-dir <dest-dir> <backup-set-directory>
-
--restore-dir <dest-dir>
Restore into this destination directory -
<backup-set-directory>
Restore from this backup set directory.
See Restore Data From Backup Sets for more information on running a restore.
Examples
Example 1: Run Full Hot Copy into a Backup Set
- Single Host Backup
-
Running full hot copy on a single host into a backup set. This command will create a new backup set directory:
/volumes/backups/test-2022-04-18
nuocmd hotcopy database --db-name test --type full --backup-dirs 1 /volumes/backups/test-2022-04-18
The --type
option isfull
. - Coordinated Backup
-
Running a coordinated full hot copy on multiple hosts into backup sets is similar, except that
--backup-dirs
defines multiple archives (in this example archives 0 and 2 are copied).nuocmd hotcopy database --db-name test --type full --backup-dirs 0 /volumes/backups/test-2022-04-18-archive-0 2 /volumes/backups/test-2022-04-18-archive-2
- Backing up All SMs
-
If each host has the same directory structure for storing backup sets, and you really wish to backup all SMs at once (not recommended), then
--default-backup-dirs
can be used to simplify the syntax.nuocmd hotcopy database --db-name test --type full --default-backup-dirs /volumes/backups/test-2022-04-18
If
/volumes/backups
is a shared network drive, add--shared
to the command. The backup set for each archive will become a sub-directory of the/volumes/backups/test-2022-04-18
.Backing up all SMs at the same time is rarely useful (even when you are using storage groups) and will place additional load on all SMs in the domain, reducing performance.
Example 2: Restore an Archive from a Full Hot Copy Backup Set
Specify the directory to copy the restored archive into using the --restore-dir
option.
The directory given to --restore-dir
must not exist or must be empty.
Example: Restore from the backup set created in the previous example to archive directory /volumes/archives/test2
.
nuoarchive restore --restore-dir /volumes/archives/test2 /volumes/backups/test-2022-04-18