Backup Ninja agent, also known as a bartender, is an application that runs as a service on a database host and as a command-line interface to Backup Ninja API servers.
The command-line interface will look for the default configuration file at
/etc/bartender.yaml. This path can be customized with
--config flag. As you can tell by looking at the file extension name, the configuration lines follow the YAML structure and it is automatically generated by a periodic pull from Backup Ninja API servers.
To get the list of supported command-line arguments and flags, simply run the command with
$ bartender --help bartender Usage: bartender [install|uninstall|deleteservice|upgrade|restart|decrypt|get-file] Subcommands: install (i) - Initialize the agent on the first installation and set it up as a service uninstall (u) - Uninstall the agent service & package deleteservice - Delete the agent service upgrade (p) - Upgrade the agent to the latest version restart (r) - Restart the agent service decrypt (d) - Decrypt encrypted backup get-file (g) - Download/Decrypt/Decompress/Copy a backup file Flags: --version Displays the program version string. -h --help Displays help with available flag, subcommand, and positional value parameters. -c --config Path to the configuration file. "/etc/bartender.yaml" by default. (default: /etc/bartender.yaml) -d --db Database connection string, eg. mysql://user:[email protected]:3306 postgres://user:[email protected] mysql:/var/run/mysqld/mysqld.sock
Looking at the output above, there are a number of subcommands and global flags available. For every subcommand, you can get further details on the available options and arguments positioning by appending
help, for example:
$ bartender decrypt help
The following table explains the global flags available for
||Displays help with the available flags, subcommands and positional value parameters.|
||Displays the program version string.|
||Path to the configuration file. Default is
||The database connection string to perform a backup.|
Subcommand Usage and Examples
Initialize the agent on the first installation and set it up as a service. The shorthand for this subcommand is I and it does not accept any argument.
$ bartender install
Uninstall the agent service and package on the database node. The shorthand for this subcommand is u and it does not accept any argument.
$ bartender uninstall
Delete the agent service on the database node. It neither does have shorthand nor accept any argument.
$ bartender deleteservice
Upgrade the agent to the latest version. The upgrade procedure will include an automatic agent restart. The shorthand for this subcommand is
p and it does not accept any argument.
$ bartender upgrade
Restart the agent service. This command is similar to the OS system restart, for example
systemctl restart bartender. The shorthand for this subcommand is
r and it does not accept any argument.
$ bartender restart
Decrypts encrypted backup file using a schedule name or encryption key. The shorthand for this subcommand is
u and it accepts the following flags:
||Schedule name that was used for backup creation.|
||Path to the backup file.|
||Encryption key when you first configured the backup schedule.|
||Output, stdout by default.|
||Decompress the file. Use this flag if compression is enabled for this backup. Does not accept any argument.|
$ bartender decrypt -k 14ca46fc2d501eac6381034e8158c19dxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx -f /storage/backups/backup.tar.gz -x -o my_backup_decrypted.tar
Download/Decrypt/Decompress/Copy a backup file. This option is mainly built to download backup from cloud storage (if enabled) onto the backup host, for restoration or copying purposes. Using
get-file a local storage backup will decrypt and decompress if required. The shorthand for this subcommand is g and it accepts the following flags:
||File ID to download, decrypt and decompress. Go to
||Output, stdout by default.|
$ bartender get-file -f bsil9dkbhbisfb90hrag -o mysqldump_all_2019-10-15_051000_.sql