Backing Up the Database
Use vbr
to save your data to a variety of locations:
- A local directory on the nodes in a cluster
- One or more hosts outside of the cluster
- A different Vertica cluster (effectively cloning your database)
Note: Creating a database backup on a different cluster does not provide disaster recovery. The cloned database you create with vbr
is entirely separate from the original, and is not kept synchronized with the database from which it is cloned.
When to Back up the Database
In addition to any guidelines established by your organization, OpenText recommends that you back up your database:
- Before you upgrade Vertica to another release.
- Before you drop a partition.
- After you load a large volume of data.
- If the epoch in the latest backup is earlier than the current ancient history mark (AHM).
- Before and after you add, remove, or replace nodes in your database cluster.
- After recovering a cluster from a crash.
Note: When you restore a database backup, you must restore to a cluster that is identical to the one where you created the backup. For this reason, always create a new backup after adding, removing, or replacing nodes.
Ideally, create regular backups of your full database. You can run the Vertica vbr
utility from a cron job or other task scheduler.
Creating the Backup Configuration File
The vbr
utility uses a configuration file for the information required to back up and restore a full- or object-level backup. The configuration file defines where the database backup is saved, the temporary directories it uses, and which nodes, schema, and/or tables in the database are to be backed up. You cannot run vbr
without a configuration file, and no default file exists.
To invoke the script to set up a configuration file, enter this command:
$ vbr --setupconfig
The script prompts you to answer the following questions regarding the configuration file. Type Enter to accept the default value in parentheses. See VBR Configuration File Reference in the Administrator’s Guide for information about specific questions.
[dbadmin@localhost ~]$ /opt/vertica/bin/vbr --setupconfig
Snapshot name (backup_snapshot): fullbak1
Number of restore points (1): 3
Specify objects (no default):
Object restore mode (coexist, createOrReplace or create) (createOrReplace):
Vertica user name (dbadmin):
Save password to avoid runtime prompt? (n) [y/n]: y
Password to save in vbr config file (no default):
Node v_vmart_node0001
Backup host name (no default): 194.66.82.11
Backup directory (no default): /home/dbadmin/backups
Config file name (fullbak1.ini):
Password file name (no default value) (no default):pwdfile
Change advanced settings? (n) [y/n]: n
Saved vbr configuration to fullbak1.ini.
Saved vbr database password to pwdfile.ini.
After you answer the required questions, vbr
generates a configuration file with the information you supplied. Use the Config file name
you specified when you run the --task backup
or other commands. The vbr
utility uses the configuration file contents for both backup and restore tasks.
Creating Full and Incremental Backups
Before you create a database backup, ensure the following:
- Your database is running.
- All of the backup hosts are up and available.
- The backup location host has sufficient disk space to store the backups.
- The user who starts the utility has write access to the target directories on the host backup location.
Run the vbr
script from a terminal using the database administrator account from an initiator node in your database cluster. You cannot run the utility as root.
Use the --task backup
and --config-file
filename directives as shown in this example.
[release@qco55srv01:/scratch_b/qa/vertica/QA/VT_Scenario 0]$ vbr -t backup --config $FULLBAK_CONFIG Starting backup of database VTDB. Participating nodes: v_vmart_node0001, v_vmart_node0002, v_vmart_node0003, v_vmart_node0004. Snapshotting database. Snapshot complete. Approximate bytes to copy: 2315056043 of 2356089422 total. [==================================================] 100% Copying backup metadata. Finalizing backup. Backup complete!
By default, there is no screen output other than the progress bar.
If you do not specify a configuration file, the vbr
utility searches for one at this location:
/opt/vertica/config/vbr.ini
If the utility does not locate the configuration you specify, it searches for one at opt/vertica/config/vbr.ini. If no file exists there, it fails with an error.
The first time you run the vbr
utility, it performs a full backup; subsequent runs with the same configuration file create an incremental backup. When creating incremental backups, the utility copies new storage containers, which can include data that existed the last time you backed up the database, along with new and changed data since then. By default, vbr
saves one archive backup, unless you set the restorePointLimit
parameter value in the configuration file to a value greater than 1
.