Backing Up and Restoring VCS Configuration Files
VCS enables you to back up and restore VCS configuration files on each node in the cluster using the hasnap command.
The command includes the following options; each option is described in detail in the following sections:
Option
|
Action
|
hasnap -backup
|
Backs up files in a snapshot format.
|
hasnap -restore
|
Restores a previously created snapshot.
|
hasnap -display
|
Displays details of previously created snapshots.
|
hasnap -sdiff
|
Displays files that were changed on the local system after a specific snapshot was created.
|
hasnap -fdiff
|
Displays the differences between a file in the cluster and its copy stored in a snapshot.
|
hasnap -export
|
Exports a snapshot from the local, predefined directory to the specified file.
|
hasnap -include
|
Configures the list of files or directories to be included in new snapshots, in addition to those included automatically by the -backup command.
|
hasnap -exclude
|
Configures the list of files or directories to be excluded from new snapshots when backing up the configuration using the -backup command.
|
hasnap -delete
|
Deletes snapshots from the predefined local directory on each node.
|
Note
With the exception of the -include, -exclude, and the -delete options, all options can be combined with the -f option. This option indicates that all files be backed up to or restored from the specified single file instead of a local, predefined directory on each node. This option is useful when you want to store the configuration data to an alternate location that is periodically backed up using backup software like VERITAS Net Backup.
hasnap -backup
The hasnap -backup command backs up files in a snapshot format. A snapshot is a collection of VCS configuration files backed up at a particular point in time, typically before making changes to the existing configuration. A snapshot also contains information such as the snapshot name, description, creation time, and file permisisons.
The command backs up a predefined list of VCS configuration files as well as a user-defined list. The predefined list includes all the *.cf files, custom agents, LLT and GAB configuration files, triggers, custom heartbeats, and action scripts. Please see the -include and -exclude commands to construct a user-defined list.
Syntax
hasnap -backup [-f filename] [-n] [-m description]
Options
-n: Runs the command in the non-interactive mode
-m: Specifies a description of the snapshot
Examples
The following command creates a backup of the configuration in the non-interactive mode and adds "Test Backup" as the backup description.
# hasnap -backup -n -m "Test Backup"
The following command creates a backup of the configuration files and saves it as /tmp/backup-2-2-2003 on the node where the command was run.
# hasnap -backup -f /tmp/backup-2-2-2003
hasnap -restore
The hasnap -restore command restores configuration files from a previously created snapshot.
Syntax
hasnap -restore [-f filename] [-n] [-s snapid]
Options
-n: Runs command in the non-interactive mode
-s: Specifies the ID of the snapshot to be restored
If no snapshot ID is specified, -restore displays which snapshots are available for restoration.
Examples
The following command restores the snapshot vcs-20030101-22232 in the non-interactive mode.
# hasnap -restore -n -s vcs-20030101-22232
The following command restores the snapshot stored in the file /tmp/backup-2-2-2003.
# hasnap -restore -f /tmp/backup-2-2-2003
hasnap -display
The hasnap -display command displays details of previously created snapshots.
Syntax
hasnap -display [-f filename] [-list|-s snapid] [-m] [-l] [-t]
Options
-list: Displays the list of snapshots in the repository
-s: Identifies the snapshot ID
-m: Displays snapshot description
-l: Displays the list of files in the snapshot
-t: Displays the snapshot timestamp
If no options are specified, the command displays all information about the latest snapshot.
Examples
The following command lists all snapshots.
# hasnap -display -list
The following command displays the description and the time of creation of the specified snapshot.
# hasnap -display -s vcs-20030101-2232 -m -t
The following command displays the description, the timestamp, and the list of all files in the snapshot file /tmp/backup-2-2-2003
# hasnap -display -f /tmp/backup-2-2-2003
hasnap -sdiff
The hasnap -sdiff command displays files that were changed on the local system after a specific snapshot was created.
Syntax
hasnap -sdiff [-f filename] [-s snapid] [-sys hostname]
Options
-s: Identifies the snapshot ID of the comparison snapshot.
-sys: Indicates the host on which the snapshot is to be compared.
If no options are specified, -sdiff uses the latest snapshot to compare the files on each node in the cluster.
Examples
The following command displays the differences between the current configuration and the snapshot vcs-20030101-22232.
# hasnap -sdiff -s vcs-20030101-22232
The following command displays the difference between the configuration on system host1 and the snaphot stored in the file /tmp/backup-2-2-2003.
# hasnap -sdiff -f /tmp/backup-2-2-2003 -sys host1
hasnap -fdiff
The hasnap -fdiff command displays the differences between a file currently on the cluster and its copy stored in a previously created snapshot.
Syntax
hasnap -fdiff [-f filename] [-s snapid] [-sys hostname] file
Options
-s: Identifies the snaphot ID of the snapshot.
-sys: Indicates the host on which the specified file is to be compared.
file: Identifies the comparison file.
If no options are specified, -fdiff uses the latest snapshot to compare the file on each node in the cluster.
Examples
The following command displays the differences between the files /etc/VRTSvcs/conf/config/main.cf on host1 and its version in the last snapshot.
# hasnap -fdiff -sys host1 /etc/VRTSvcs/conf/config/main.cf
The following command displays the differences between the files /var/llttab on each node in the cluster and the version stored in the snapshot contained in the file /var/backup-2-2-2003.
# hasnap -fdiff -f /tmp/backup-2-2-2003 /etc/llttab
hasnap -export
The hasnap -export command exports a snapshot from the local, predefined directory on each node in the cluster to the specified file. This option is useful when you want to store a previously created snapshot to an alternate location that is periodically backed up using backup software like VERITAS NetBackup.
Syntax
hasnap -export -f filename [-s snapid]
Options
-s: Indicates the snapshot ID to be exported.
If the snapshot ID is not specified, the command exports the latest snapshot to the specified file.
Example
The following command exports data from snapshot vcs-20030101-22232 from each node in the cluster to the file /tmp/backup-2-2-2003 on the current node.
# hasnap -export -f /tmp/backup-2-2-2003 -s vcs-20030101-22232
hasnap -include
The hasnap -include command configures the list of files or directories to be included in new snapshots, in addition to those included automatically by the -backup command. Please see section on the -backup command for the list of files automatically included for VCS.
Syntax
hasnap -include -add|-del|-list [-sys hostname] files|directories
Options
-add: Adds the specified files or directories to the include file list.
-del: Deletes the specified files or directories from the include file list.
-list: Displays the files or directories in the include file list.
files/directories: Identifies the file or directory names to be added to or deleted from the include list. Use this attribute with the -add or -delete options only.
Examples
The following command displays the list of files or directories to be included in new snapshots on each node of the cluster.
# hasnap -include -list
The following command adds the file /opt/VRTSweb/conf/vrtsweb.xml to the include list on host1, which results in this file being included in the snapshot the next time the hasnap -backup command is run.
# hasnap -include -add /opt/VRTSweb/conf/vrtsweb.xml
The following command removes the file /opt/VRTSweb/conf/vrtsweb.xml from the include list on host1.
# hasnap -include -del -sys host1 /opt/VRTSweb/conf/vrtsweb.xml
hasnap -exclude
The hasnap -exclude command configures the list of files or directories that should not be included in new snapshots when backing up the configuration using the -backup command.
Syntax
hasnap -exclude -add|-del|-list [-sys hostname] files|directories
Options
-add: Adds the specified files or directories to the exclude file list.
-del: Deletes the specified files or directories from the exclude file list.
-list: Displays the files or directories in the exclude file list.
files/directories: Identifies the files or directories to be added to or deleted from the exclude list. Use this attribute with the -add or -delete options only.
Examples
The following command displays the exclude file list on each node in the cluster.
# hasnap -exclude -list
The following command adds the file /etc/VRTSvcs/conf/config/temp.cf to the exclude file list on host1, which results in this file being excluded from the snapshot the next time the hasnap -backup command is run.
# hasnap -exclude -add -sys host1 /etc/VRTSvcs/conf/config/temp.cf
The following command removes the file /etc/VRTSvcs/conf/config/temp.cf from the exclude list on host1.
# hasnap -exclude -del -sys host1 /etc/VRTSvcs/conf/config/temp.cf
hasnap -delete
The hasnap -delete command deletes previously created snapshots from the predefined local directory on each node.
Syntax
hasnap -delete [-s snapid]
Options
-s: Snapshot ID to be deleted.
If the snapshot ID is not specified, the command displays a list of snapshots available for deletion.
Example
The following command deletes snapshot vcs-20030101-22232 from the cluster.
# hasnap -delete -s vcs-20030101-22232
|