This topic describes how to initiate a full data backup after log archiving is enabled.
Prerequisites
Before you initiate a full data backup, make sure that archiving mode is enabled. You can initiate a data backup only when the STATUS of the log archiving task is DOING.
For more information about how to view the status of a log archiving task, see View archiving progress.
For more information about how to enable archiving mode, see Enable archiving mode.
(Optional) Preparations
Before you initiate a data backup, you can set a password for the backup set.
Log in to the
systenant of the cluster as therootuser.(Optional) Execute the following statement to set a backup password:
Note
This password is for the backup set after backup. If this option is set, you must enter this password when restoring from this backup set, and this password cannot be deleted.
obclient [(none)]> SET ENCRYPTION ON IDENTIFIED BY 'password' ONLY;Here is an example:
obclient [(none)]> SET ENCRYPTION ON IDENTIFIED BY '******' ONLY;Note
After setting the backup password, before initiating the data backup, you can cancel this setting by disconnecting the session and then reconnecting to the database.
Initiate a full data backup
After you complete the preparations, you can perform the following steps to initiate a full data backup.
Assume the current cluster has three tenants: sys, mysql_tenant, and mysql_tenant1, and both tenants mysql_tenant and mysql_tenant1 have completed the preparation before initiating a data backup.
Initiate a full data backup from the sys tenant
The sys tenant can initiate a full data backup for all or specified tenants in the cluster.
Log in to the
systenant of the cluster as therootuser.(Optional) Set the backup concurrency for the tenant.
The backup concurrency is specified by the tenant-level configuration item
ha_low_thread_score, which specifies the number of threads used for medium- and low-priority task queues, such as backup and backup cleanup. The value range is [0, 100]. The default value is0. Before you initiate a backup, you can increase the value of theha_low_thread_scoreconfiguration item. We recommend that you double the value each time. For more information about the operations related to theha_low_thread_scoreconfiguration item, see View data backup parameters.For more information about the
ha_low_thread_scoreconfiguration item, see ha_low_thread_score.Execute the following statement to set the backup concurrency for all tenants in the cluster:
obclient [(none)]> ALTER SYSTEM SET ha_low_thread_score = 10 TENANT = all_user;Alternatively, execute the following statement:
obclient [(none)]> ALTER SYSTEM SET ha_low_thread_score = 10 TENANT = all;Note
TENANT = all_userandTENANT = allhave the same semantics. If you want the setting to take effect for all user tenants, we recommend that you useTENANT = all_user.TENANT = allwill be deprecated.Execute the following statement to set the backup concurrency for a specified tenant in the cluster:
obclient [(none)]> ALTER SYSTEM SET ha_low_thread_score = 10 TENANT = mysql_tenant;
Execute the following statement to initiate a full data backup.
Initiate a full data backup for all tenants in the cluster
You can initiate a full data backup for all tenants in the cluster.
ALTER SYSTEM BACKUP DATABASETo initiate a full data backup for all tenants in the cluster, execute the following statement:
obclient [(none)]> ALTER SYSTEM BACKUP DATABASE;After the statement is executed, the system initiates a full data backup for the
mysql_tenantandmysql_tenant1tenants in the cluster in this example.Initiate a full data backup for a specified tenant in the cluster
You can initiate a full data backup for a specified tenant without affecting other tenants in the cluster. Here is a sample statement:
ALTER SYSTEM BACKUP TENANT = mysql_tenant;To initiate a full data backup for the
mysql_tenanttenant, execute the following statement:obclient [(none)]> ALTER SYSTEM BACKUP TENANT = mysql_tenant;Note
If you specify multiple tenants, separate the tenant names with commas (,).
After the statement is executed, the system initiates a full data backup for the
mysql_tenanttenant.
You can view the backup progress in real time. For more information, see View the data backup progress.
Initiate a full data backup from a user tenant
You can initiate a full data backup for a user tenant without affecting other tenants.
Log in to the database as a tenant administrator.
In this example, you can log in to the
mysql_tenantormysql_tenant1tenant as therootuser.(Optional) Set the backup concurrency.
The backup concurrency is specified by the tenant-level configuration item
ha_low_thread_score, which specifies the number of threads used for medium- and low-priority task queues, such as backup and backup cleanup. The value range is [0, 100]. The default value is0. Before you initiate a backup, you can increase the value of theha_low_thread_scoreconfiguration item. We recommend that you double the value each time. For more information about the operations related to theha_low_thread_scoreconfiguration item, see View data backup parameters.For more information about the
ha_low_thread_scoreconfiguration item, see ha_low_thread_score.obclient [(none)]> ALTER SYSTEM SET ha_low_thread_score = 10;Execute the following statement to initiate a full data backup:
ALTER SYSTEM BACKUP DATABASE;To initiate a full data backup for the current tenant, execute the following statement:
obclient [(none)]> ALTER SYSTEM BACKUP DATABASE;After the statement is executed, the system initiates a full data backup for the current tenant.
You can view the backup progress in real time. For more information, see View the data backup progress.