Skip to content

ybbackup Examples

This section contains some simple examples of backup commands, using different options.

Run a full backup of a database

This example backs up a database for the first time. Here is a breakdown of the ybbackup command options used in this example:

Command SyntaxExplanation
ybbackupCall the ybbackup tool on the client.
-WPrompt for the user's password.
--username yb100Run as user yb100 (must be a superuser).
-d premdbBack up the premdb database.
--fullTake a full backup.
--name Oct23FullName the backup Oct23Full.
--chain October2019Name the backup chain October2019.
/home/yb100/premdb_daily_backupsStore the backup files in this directory (no option name required).

Note: The host is not set explicitly in this case. It is set with the YBHOST environment variable.

Here is the command line and the full output of the backup operation:

~$ ybbackup -W --username yb100 -d premdb --full --name Oct23Full --chain October2019 /home/yb100/premdb_daily_backups
Password for user yb100: 
15:16:16.003 [ INFO] ABOUT CLIENT:
   app.cli_args         = "-W" "--username" "yb100" "-d" "premdb" "--full" "--name" "Oct23Full" "--chain" "October2019" "/home/yb100/premdb_daily_backups"
   app.name_and_version = "Yellowbrick Backup and Restore version 4.0.0-1464"
   java.home            = "/usr/lib/jvm/java-8-oracle/jre"
   java.version         = "1.8.0_101"
   jvm.memory           = "512.00 MB (max=4.00 GB)"
   jvm.name_and_version = "Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)"
   jvm.options          = "-Xms512m, -Xmx4g, -XX:+UseG1GC, -Dapp.name=ybbackup2, -Dapp.pid=31652, -Dapp.repo=/opt/ybtools/lib, -Dapp.home=/opt/ybtools, -Dbasedir=/opt/ybtools"
   jvm.vendor           = "Oracle Corporation"
   os.name_and_version  = "Linux 4.4.0-31-generic (amd64)"

15:16:16.004 [ INFO] Running backup using output locations: [file:///home/yb100/premdb_daily_backups]
15:16:16.670 [ INFO] Collecting metadata for object premdb
15:16:16.756 [ INFO] Cluster UUID: 0620603c-91fb-43b0-a5b7-2bcd2ba2cc84
15:16:16.756 [ INFO] DB      UUID: 210233bb-9477-23cd-1eae-2cacffeae2be
15:16:16.756 [ INFO] Encoding    : 16
15:16:16.756 [ INFO] CType       : C
15:16:16.756 [ INFO] Collation   : C
15:16:16.756 [ INFO] Metadata collection for object premdb complete
ybbackup_meta | 100.0% |         Read: 7.26 KiB / 7.26 KiB         |     Write: 7.29 KiB     |  0.00 B/s   |   2019-10-23 15:16:18  

ybbackup_data | 100.0% |       Read: 950.68 MiB / 950.68 MiB       |    Write: 950.96 MiB    |  4.07 MB/s  |   2019-10-23 15:17:14

Run an incremental backup of the same database after loading new rows

The only changes to the previous command are the backup type (--inc) and the backup name (--name Oct23Inc1):

$ ybbackup -W --username yb100 -d premdb --inc --name Oct23Inc1 --chain October2019 /home/yb100/premdb_daily_backups
Password for user yb100: 
15:58:33.395 [ INFO] ABOUT CLIENT:
...
15:58:33.396 [ INFO] Running backup using output locations: [file:///home/yb100/premdb_daily_backups/]
15:58:35.548 [ INFO] Collecting metadata for object premdb
15:58:35.602 [ INFO] Cluster UUID: 0620603c-91fb-43b0-a5b7-2bcd2ba2cc84
15:58:35.602 [ INFO] DB      UUID: 210233bb-9477-23cd-1eae-2cacffeae2be
15:58:35.602 [ INFO] Encoding    : 16
15:58:35.603 [ INFO] CType       : C
15:58:35.603 [ INFO] Collation   : C
15:58:35.603 [ INFO] Metadata collection for object premdb complete
ybbackup_meta | 100.0% |         Read: 1.29 KiB / 1.29 KiB         |     Write: 1.31 KiB     |  0.00 B/s   |   2019-10-23 15:58:36  

ybbackup_data | 100.0% |       Read: 951.68 MiB / 951.68 MiB       |    Write: 951.97 MiB    |  4.23 MB/s  |   2019-10-23 15:59:29

Run a backup to multiple storage locations

This example takes a single cumulative backup of a database and spreads the backup files across multiple directories:

$ ybbackup -W --username yb100 -d worldcupdb --cumu --name worldcupOct23Cumu --chain wcdb 
/home/ybbackups/wcdb_daily_backups/bk1
/home/ybbackups/wcdb_daily_backups/bk2
/home/ybbackups/wcdb_daily_backups/bk3
/home/ybbackups/wcdb_daily_backups/bk4

Note that the result of this type of command is one backup stored across multiple locations. To restore from this backup, make sure you name the first backup directory in the ybrestore command. This directory contains the metadata files (metaDB.*) for the backup.

Run a full backup that excludes a schema

This command takes a full backup of the specified database but excludes one of its schemas, using the --exclude option.

$ ybbackup -W --username yb100 -d worldcupdb --full --name worldcupOct24Full 
--exclude uefa --chain wcdb /home/ybbackups/wcdb_daily_backups

Parent topic:ybbackup Commands