Skip to content

ybbackup Examples

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

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.
-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 local directory (no option name required, just the path). An S3 storage path would look like this:


s3://ybbobr/premdb_bar


An Azure Blob storage path would look like this:


azure://premdb_bar


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

$ export YBHOST=ybdemo.devue1.myawsvpc.com

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

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

Backup with 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.

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

Full backup to object storage

The following command takes a full backup and writes the files to an AWS S3 bucket. Note the "object store" options and the path to S3 where the backup files will be stored. This example also uses the --temp-workdir option.

% ./ybbackup --full --name Feb17Full --chain Feb2023 
--object-store-region us-west-2 --object-store-identity ****************** --object-store-credential **************************************** 
--temp-workdir /Users/brumsby/tmp_backups 
s3://ybbobr/premdb_bar
14:50:14.474 [ INFO] ABOUT CLIENT:
...
14:50:14.475 [ INFO] Running backup using output locations: [s3://ybbobr/premdb_bar]
...
14:50:16.316 [ INFO] Loaded file handler for s3://
14:50:16.317 [ INFO] 
Configuration (S3 client):
   endpoint           : ********
   region             : us-west-2
   identity/credential: ********
14:50:17.833 [ INFO] Collecting metadata for object premdb
...
14:51:40.972 [ INFO] Done

Parent topic:ybbackup Commands