Skip to content

ybbackupctl Examples

The following examples show how to use the ybbackupctl tool to list, delete, purge, or copy backups.

Example: List Backups with the --verbose option

$ ybbackupctl --list /home/yb100/premdb_daily_backups --verbose
16:02:32.348 [ INFO] ABOUT CLIENT:
   app.cli_args         = "--list" "/home/yb100/premdb_daily_backups" "--verbose"
   app.name_and_version = "Yellowbrick Backup and Restore version 4.0.0-1385"
   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=ybbackupctl, -Dapp.pid=12991, -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)"

16:02:32.349 [ INFO] Running backup control using input locations: [file:/home/yb100/premdb_daily_backups/]
Database: premdb (057af4c6-b817-4181-0b51-0f7e65df3df0)
Chain: October2019
   Tables                                                         size    deleted rows   inserted rows 
   (6 total)                                                      (GB)         (total)         (total) 
     public.hometeam                                              0.00               0              50 
     public.awayteam                                              0.00               0              50 
     public.season                                                0.00               0              25 
     public.match                                                 0.04               0         2203136 
     public.team                                                  0.00               0              50 
     public.newmatchstats                                         0.24               0        24785280 

Restore points:

       type                                snapshot_name            backup_timestamp   size (GB)  
       FULL                                October15Full 2019-10-15T22:16:23.108024Z        0.00  
 INCREMENTAL                                October15Inc1 2019-10-15T22:20:42.999975Z        0.01  
 INCREMENTAL                                October15Inc2 2019-10-15T22:55:10.787697Z        0.23  
 INCREMENTAL                                October15Inc3 2019-10-15T23:02:15.944328Z        0.04

Example: Remove Backups

You can use the ybbackupctl --delete command to remove specific backups from the system. For example:

$ ybbackupctl --delete --point Feb16Inc --uuid 'fed0f424-94c8-3945-b3cc-b7e926db03e8' --chain February2020 /home/yb100/premdb_daily_backups
21:43:16.743 [ INFO] ABOUT CLIENT:
   app.cli_args         = "--delete" "--point" "Feb16Inc" "--uuid" "fed0f424-94c8-3945-b3cc-b7e926db03e8" "--chain" "February2020" "/home/yb100/premdb_daily_backups"
   app.name_and_version = "Yellowbrick Backup and Restore version 4.0.0-21024"
   java.home            = "/usr/lib/jvm/java-8-oracle/jre"
   java.version         = "1.8.0_101"
   jvm.memory           = "512.00 MB (max=8.00 GB)"
   jvm.name_and_version = "Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)"
   jvm.options          = "-Xms512m, -Xmx8g, -XX:+UseG1GC, -Dapp.name=ybbackupctl, -Dapp.pid=17155, -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)"

21:43:16.744 [ INFO] Running backup control using input locations: [file:///home/yb100/premdb_daily_backups/]
21:43:17.989 [ INFO] Removing backup:[Feb16Inc] from database:[premdb/fed0f424-94c8-3945-b3cc-b7e926db03e8] chain:[February2020] as selected by criteria:[snapshot_name=Feb16Inc]

Example: Purge Backups

You can purge obsolete FULL backups and INVALID backups. The following example finds two full backups of the same database and purges the older one:

$ ybbackupctl --purge FULL /home/yb100/premdb_daily_backups --chain February2020 --uuid fed0f424-94c8-3945-b3cc-b7e926db03e8
21:47:59.726 [ INFO] ABOUT CLIENT:
...
21:47:59.728 [ INFO] Running backup control using input locations: [file:///home/yb100/premdb_daily_backups/]
21:48:01.347 [ INFO] Removing backup [Feb14Full/FULL] from backup chain: [February2020] taken from: [premdb/fed0f424-94c8-3945-b3cc-b7e926db03e8] at: [2020-02-15T00:37:56.943504Z] because a newer FULL exists

An invalid backup is a partial backup that failed at some point in the ybbackup operation. In this case, an invalid backup was found and deleted:

$ ybbackupctl --purge INVALID /home/yb100/premdb_backups --chain Sept2019 --uuid 0bee7ef7-0736-6938-5f33-2b9b419c8d30
17:47:31.597 [ INFO] ABOUT CLIENT:
   app.cli_args         = "--purge" "INVALID" "/home/yb100/premdb_backups" "--chain" "Sept2019" "--uuid" "0bee7ef7-0736-6938-5f33-2b9b419c8d30"
   app.name_and_version = "Yellowbrick Backup and Restore version 4.0.0-913"
...
Removing backup [Sept9_2019_IncAgain/INCREMENTAL] from backup chain: [Sept2019] taken from: [0bee7ef7-0736-6938-5f33-2b9b419c8d30/0bee7ef7-0736-6938-5f33-2b9b419c8d30] at: [2019-09-10T00:46:50.931097Z] because it is incomplete

Example: Copy a Backup to Another Location

In this example the backup is copied from the current working directory (which is premdb_daily_backups) to a directory called CopyPremdbFeb18Full:

yb100@yb100:~/premdb_daily_backups$ ybbackupctl --copy-to /home/yb100/CopyPremdbFeb18Full --point Feb18Full --chain February2020 --uuid 'fed0f424-94c8-3945-b3cc-b7e926db03e8'
20:59:47.391 [ INFO] ABOUT CLIENT:
   app.cli_args         = "--copy-to" "/home/yb100/CopyPremdbFeb18Full" "--point" "Feb18Full" "--chain" "February2020" "--uuid" "fed0f424-94c8-3945-b3cc-b7e926db03e8"
   app.name_and_version = "Yellowbrick Backup and Restore version 4.0.0-21024"
   java.home            = "/usr/lib/jvm/java-8-oracle/jre"
   java.version         = "1.8.0_101"
   jvm.memory           = "512.00 MB (max=8.00 GB)"
   jvm.name_and_version = "Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)"
   jvm.options          = "-Xms512m, -Xmx8g, -XX:+UseG1GC, -Dapp.name=ybbackupctl, -Dapp.pid=3195, -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)"

20:59:47.392 [ INFO] Running backup control using input locations: [file:/home/yb100/premdb_daily_backups/]
20:59:56.666 [ INFO] Successfully copied backup [snapshot_name=Feb18Full]
yb100@yb100:~/premdb_daily_backups$ cd /home/yb100/CopyPremdbFeb18Full
yb100@yb100:~/CopyPremdbFeb18Full$ ls
05  0f  21  26  35  38  53  58  5d  74  87  95  9d  a8  b7  d5  f9  metaDB.mv.db  metaDB.mv.db.backup.Tue  metaDB.sql  metaDB.trace.db
yb100@yb100:~/CopyPremdbFeb18Full$

The following equivalent ybbackupctl copy-to command explicitly specifies both the destination directory (in the same place as before) and the input directory (at the end of the command). In other words, this version of the command does not rely on the location of the user's current working directory.

$ ybbackupctl --copy-to /home/yb100/CopyPremdbFeb18Full --point Feb18Full --chain February2020 --uuid 'fed0f424-94c8-3945-b3cc-b7e926db03e8' /home/yb100/premdb_daily_backups
20:59:47.391 [ INFO] ABOUT CLIENT:
...

Example: Fix the Path to a Backup After Moving It

In this example, backup files have been moved from their original (or expected) location. The ybbackupctl command fixes the path to the backup bundle by using the --fix-bundle-paths option. Subsequent backup and restore operations will be able to use the updated path.

In this case, the original location of some backups was renamed to: /home/yb100/premdb_february2020_backups. The command checks the original location and the renamed location to verify that each file exists at the new location.

$ ybbackupctl -X /home/yb100/premdb_february2020_backups
22:45:47.248 [ INFO] ABOUT CLIENT:
   app.cli_args         = "-X" "/home/yb100/premdb_february2020_backups"
   app.name_and_version = "Yellowbrick Backup and Restore version 4.0.0-21176"
   java.home            = "/usr/lib/jvm/java-8-oracle/jre"
   java.version         = "1.8.0_101"
   jvm.memory           = "512.00 MB (max=8.00 GB)"
   jvm.name_and_version = "Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)"
   jvm.options          = "-Xms512m, -Xmx8g, -XX:+UseG1GC, -Dapp.name=ybbackupctl, -Dapp.pid=18236, -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)"

22:45:47.249 [ INFO] Running backup control using input locations: [file:///home/yb100/premdb_february2020_backups/]
22:45:48.546 [ INFO] Found bundle. Locations stored in the bundle=[file:///home/yb100/premdb_daily_backups] : [UUID=e80517b2-a944-b0ba-1213-3c4187b96942] [ChainName=February2020]
22:45:48.875 [ INFO] Verifying files for [Database=premdb] [Backup chain=February2020] [Snapshot name=Feb20Full] [Backup type=FULL]
22:45:48.875 [ INFO] Verifying backup file: [relative path=/0f/be/5d/2f/bc/0fbe5d2f-bcc2-4ab0-a804-83d739f81ff6] [file size=5811] [#packets=1] [#objects=1] [objectType=Catalog data]
22:45:48.876 [ WARN] [File=/0f/be/5d/2f/bc/0fbe5d2f-bcc2-4ab0-a804-83d739f81ff6] was not found at the expected [location=file:///home/yb100/premdb_daily_backups]. Checking alternatives.
22:45:48.888 [ WARN] [File=/0f/be/5d/2f/bc/0fbe5d2f-bcc2-4ab0-a804-83d739f81ff6] was found at the new [location=file:///home/yb100/premdb_february2020_backups/] and it passes all checks. Updated metadata.
22:45:48.896 [ INFO] Verifying backup file: [relative path=/4d/4d/af/05/a8/4d4daf05-a837-47a9-8228-9d6aa8702014] [file size=283557] [#packets=2] [#objects=1] [objectType=Table data]
22:45:48.896 [ WARN] [File=/4d/4d/af/05/a8/4d4daf05-a837-47a9-8228-9d6aa8702014] was not found at the expected [location=file:///home/yb100/premdb_daily_backups]. Checking alternatives.
22:45:48.901 [ WARN] [File=/4d/4d/af/05/a8/4d4daf05-a837-47a9-8228-9d6aa8702014] was found at the new [location=file:///home/yb100/premdb_february2020_backups/] and it passes all checks. Updated metadata.
22:45:48.903 [ INFO] Verifying backup file: [relative path=/66/cb/96/f9/aa/66cb96f9-aaf1-4ee4-b6fb-204ab1a8b85a] [file size=3603] [#packets=1] [#objects=1] [objectType=Table data]
...

Now the ybbackupctl --list command (for example) will recognize the new location:

$ ybbackupctl --list /home/yb100/premdb_february2020_backups
22:46:46.582 [ INFO] ABOUT CLIENT:
...
22:46:46.583 [ INFO] Running backup control using input locations: [file:///home/yb100/premdb_february2020_backups/]
Database: premdb (e80517b2-a944-b0ba-1213-3c4187b96942)
Chain: February2020
    6  Tables
...

You can now run more backups to the new location and restore databases from backups in the new location.

If the command finds that backup files exist in the expected location, their paths are checked but not fixed. For example, you will see messages like this:

...
22:41:32.904 [ INFO] Verifying files for [Database=premdb] [Backup chain=February2020] [Snapshot name=Feb20Full] [Backup type=FULL]
22:41:32.905 [ INFO] Verifying backup file: [relative path=/78/fc/a3/8b/d2/78fca38b-d2e3-4e86-81cf-2bb10a800f45] [file size=5811] [#packets=1] [#objects=1] [objectType=Catalog data]
22:41:32.905 [ INFO] [File=/78/fc/a3/8b/d2/78fca38b-d2e3-4e86-81cf-2bb10a800f45] was found at the expected location and it passes all checks. No need to fix.
...

Parent topic:ybbackupctl Commands