This topic describes the backup commands in obshell. You can use these commands to set backup configurations and view backup tasks. Make sure that the OceanBase cluster has been initialized. You can run the command with the -h or --help option to get help information.
obshell backup set-config
You can run this command to configure backup-related parameters for all tenants or a specified tenant.
${home_path}/bin/obshell backup set-config [flags]
# example
/home/admin/oceanbase/bin/obshell backup set-config -t tenant1 -d /path/to/backup/data -a /path/to/backup/archive
home_path is the installation directory of OceanBase Database. By default, obshell is located in the bin directory of the installation directory of OceanBase Database.
The following table describes the options:
| Option name | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -t/--tenant_name | N | string | No | The name of the tenant to back up configurations for. If not specified, configurations for all tenants in the cluster are backed up. |
| -d/--data_backup_uri | No | string | N/A | Sets the destination for tenant data backups. If a backup destination has been set before, this option will adopt the previous setting if left unconfigured. If no backup destination has been set before, leaving this option unconfigured will result in a default empty value.
NoteThis option only takes effect when |
| -a/--archive_log_uri | No | string | N/A | Sets the destination directory for the tenant logs. If you have specified a destination directory in the preceding step and do not specify a destination directory here, the previous directory is used. If you have not specified a destination directory in the preceding step, a default value is used here.
NoteThe option takes effect only if you specify the |
| -u/--backup_base_uri | No | string | None | The backup destination for all tenants. After you configure this option, the data backup and log archive paths for each tenant are appended to the specified directory under
NoteThis option takes effect only when you do not specify |
| -c/--log_archive_concurrency | No | int | n/a | The total number of worker threads for log archiving. |
| -b/--binding | No | string | Optional | The value must be Optional (user business takes priority) or Mandatory (archiving takes priority). If you do not specify this parameter, the system default is Optional. |
| -i/--piece_switch_interval | No | string | None | The interval for switching pieces. Value range: [1d, 7d]. |
| -l/--archive_lag_target | No | string | N/A | Specifies the lag in tenant log archiving. Make sure that the log archiving destination is properly configured before you modify this parameter. |
| -D/--delete_policy | No | string | default | Specifies the data clean-up strategy. A tenant with a specified clean-up strategy will trigger automatic clean-up every hour. At present, only the value default is supported, indicating that the scope of automatic clean-up is limited to the backups of -d/--data_backup_uri and -a/--archive_log_uri. |
| -r/--delete_recovery_window | false | string | none | specifies the time window for restoring backed-up data. The value must contain a time unit. For more information, see Parameters of backup cleanup. |
| -s/--ha_low_thread_score | false | int | No | The current number of worker threads for backup tasks and other tasks of medium and low priorities. The value range is [0, 100]. |
obshell backup show
You can run this command to query the backup tasks of all tenants or a specified tenant.
${home_path}/bin/obshell backup show [flags]
# example
/home/admin/oceanbase/bin/obshell backup show -d
home_path specifies the installation directory of OceanBase Database. By default, obshell is located in the bin directory of the OceanBase Database installation directory.
Options are described in the table below:
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -u/--backup_base_uri | No | string | None | Sets the backup destination for all tenants. After setting, each tenant's data backup path and log archive path will be concatenated under this path according to certain rules. If a backup destination was set previously and this option is not configured, the previous configuration will be used; if no backup destination was set previously and this option is not configured, it defaults to empty. |
| -m/--backup_mode | No | string | full | Data backup mode. Can be full or incremental, representing full backup (full) and incremental backup (incremental) respectively. |
| -c/--log_archive_concurrency | No | int | None | Sets the total number of worker threads for log archiving. |
| -b/--binding | No | string | Optional | Sets the priority mode for archiving and business operations. Currently supports Optional (user business priority) and Mandatory (archive priority). If not configured, defaults to Optional mode. |
| -i/--piece_switch_interval | No | string | None | Configures the switching cycle for pieces. Value range: [1d, 7d]. |
| -e/--encryption | No | string | None | Sets a password for the backup set. If this option is set, the password must be provided when restoring from this backup set, and the password cannot be deleted. |
| -l/--archive_lag_target | No | string | None | Controls the log archive delay time for tenants. To modify this, please ensure the log archive destination has been configured. |
| -D/--delete_policy | No | string | default | Sets the cleanup policy. Tenants with a cleanup policy will trigger automatic cleanup once per hour. Currently, only default is supported, which means the automatic cleanup scope is limited to backups under the value of -u/--backup_base_uri. |
| -r/--delete_recovery_window | No | string | None | Controls the recovery window for backup data. A time unit must be specified. For usage, see Backup Cleanup Parameter Introduction. |
| -s/--ha_low_thread_score | No | int | None | Specifies the current number of worker threads for low-priority tasks such as backup and backup cleanup. Value range: [0, 100]. |
| -P/--plus_archive | No | None | None | Controls whether to back up archived logs together during data backup. No value required. When this option is added, a complete dataset with archived logs will be generated in the final backup directory. |
obshell tenant backup
Use this command to configure backup-related options and perform backups for a specified tenant.
${home_path}/bin/obshell tenant backup <tenant_name> [flags]
# example
/home/admin/oceanbase/bin/obshell tenant backup t1 -d /path/to/backup/data --backup_mode incremental --encryption MySecretPassword
home_path is the OceanBase Database installation directory. By default, obshell is located in the bin directory under the OceanBase installation directory. tenant_name should be set to the name of the tenant to be backed up.
The command options are described as follows:
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -d/--data_backup_uri | No | string | None | Sets the data backup destination for the tenant. If a backup destination was set previously and this option is not configured, the previous configuration will be used; if no backup destination was set previously and this option is not configured, it defaults to empty. |
| -a/--archive_log_uri | No | string | None | Sets the log archive destination for the tenant. If a log archive destination was set previously and this option is not configured, the previous configuration will be used; if no log archive destination was set previously and this option is not configured, it defaults to empty. |
| -m/--backup_mode | No | string | full | Data backup mode. Can be full or incremental, representing full backup (full) and incremental backup (incremental) respectively. |
| -c/--log_archive_concurrency | No | int | None | Total number of worker threads for log archiving. |
| -b/--binding | No | string | Optional | Sets the priority mode for archiving and business operations. Currently supports Optional (user business priority) and Mandatory (archive priority). If not configured, defaults to Optional mode. |
| -i/--piece_switch_interval | No | string | None | Configures the switching cycle for pieces. Value range: [1d, 7d]. |
| -e/--encryption | No | string | None | Sets a password for the backup set. If this option is set, the password must be provided when restoring from this backup set, and the password cannot be deleted. |
| -l/--archive_lag_target | No | string | None | Controls the log archive delay time for the tenant. To modify this, please ensure the log archive destination has been configured. |
| -D/--delete_policy | No | string | default | Sets the cleanup policy. Tenants with a cleanup policy will trigger automatic cleanup once per hour. Currently, only default is supported, which means the automatic cleanup scope is limited to backups under the values of -d/--data_backup_uri and -a/--archive_log_uri. |
| -r/--delete_recovery_window | No | string | None | Controls the recovery window for backup data. A time unit must be specified. For usage, see Backup Cleanup Parameter Introduction. |
| -s/--ha_low_thread_score | No | int | None | Specifies the current number of worker threads for low-priority tasks such as backup and backup cleanup. Value range: [0, 100]. |
| -P/--plus_archive | No | None | None | Controls whether to back up archived logs together during data backup. No value required. When this option is added, a complete dataset with archived logs will be generated in the final backup directory. |
obshell backup show
Use this command to display backup tasks for all tenants or a specified tenant.
${home_path}/bin/obshell backup show [flags]
# example
/home/admin/oceanbase/bin/obshell backup show -d
home_path is the OceanBase Database installation directory. By default, obshell is located in the bin directory under the OceanBase installation directory.
| Option | Required | Data type | Default value | Description |
|---|---|---|---|---|
| -t/--tenant_name | No | string | None | Specifies the tenant name whose backup tasks need to be displayed. If not set, backup tasks for all tenants in the cluster will be displayed. |
| -d/--show_detail | No | None | None | Controls whether to display detailed information of backup tasks. No value required. |