All Products
Search
Document Center

Database Backup:Back up a self-managed Redis database and restore the backup data to Alibaba Cloud

Last Updated:Jul 08, 2024

Database Backup (DBS) allows you to back up self-managed databases and restore them to Alibaba Cloud databases. This topic describes how to back up a self-managed Redis database and restore the backup data to Alibaba Cloud. To do this, you need to back up the data of the self-managed Redis database to DBS, restore the backup data in DBS to an ApsaraDB for Redis instance, and then change the DBS backup source from the self-managed Redis database to the ApsaraDB for Redis instance.

Step 1: Back up the self-managed Redis database

  1. Log on to the Database Backup (DBS) console.

  2. Create a backup plan. For more information, see Create a backup plan.

    Note
    • When you purchase a backup schedule, set the Data Source Type parameter to Redis and the Backup Method parameter to Logical Backup.

    • For more information about the minimum granularity that DBS supports in backup and restoration of Redis databases, see Database engines and features.

  3. In the left-side navigation pane, click Backup Schedules. In the top navigation bar, select a region.

  4. On the Backup Schedules page, find the ID of the backup schedule that you want to configure and click Configure Backup Schedule in the Actions column.

    image

  5. In the Configure Backup Source and Destination step of the Configure Backup Schedule wizard, configure the backup source and destination, and click Next in the lower-right corner of the page.

    Section

    Parameter

    Description

    N/A

    Schedule Name

    The name of the backup schedule. DBS automatically generates a backup schedule name. We recommend that you enter a descriptive name that is easy to identify. Backup schedule names do not need to be unique.

    Backup Source Information

    Backup Mode

    The method that is used to back up data. By default, the backup method that you selected when you purchased the backup schedule is used. In this example, Logical Backup is used.

    Database Location

    The location of the source database that you want to back up. Select ECS-Hosted Database.

    ECS-Hosted Database: backs up a database that is hosted on an Elastic Compute Service (ECS) instance. You must also specify the ECS Instance ID and Port Number parameters.

    Instance Region

    The region in which the source database resides.

    Database Type

    The type of the source database. Default value: Redis.

    ECS Instance ID

    The ID of the ECS instance.

    Port Number

    The port number that is used to connect to the source database. Default value: 6379.

    Password

    The password of the database account that is used to log on to the source database.

    • If you use the default account, enter only the password. The username of the default account is default. Alternatively, you can use the account whose username is the instance ID, such as r-bp10noxlhcoim2****.

    • If you use a custom account, enter a password in the format of <username>:<password>. A password in this format can also be used for the default account.

    After you enter the username and password of the database account, click Test Connection next to the password to check whether the information about the database that you want to back up is valid. If the specified parameters are valid, the Test Passed message is displayed. If the Test Failed message is displayed, click Check next to Test Failed. Modify the information about the database that you want to back up based on the check results.

    Compliance warranty regarding cross-border data transfers

    Read and agree to the compliance commitment by selecting the check box.

    Backup Destination Information

    Backup Storage Type

    The type of storage that is used to store the backup data. Select DBS Storage (recommend).

    DBS Storage (recommended): Backup data is stored in DBS without the need to create an Object Storage Service (OSS) bucket. You are charged based on the volume of your data that is stored in DBS. For more information about the billing method, see Storage fees.

    Note

    If the volume of data to be backed up is large, we recommend that you purchase subscription storage plans to offset fees. For more information, see Use storage plans. Storage plans are more cost-efficient than the pay-as-you-go billing method.

    Storage Encryption

    The method that is used to encrypt the backup data. Select Encrypted.

    Encrypted: recommended. DBS uses AES-256 to encrypt data.

  6. In the Edit Backup Objects step, click Select All in the lower part of the Available section to move all objects to the Selected section. Click Next.

    Note
    • DBS allows you to back up a single table, a single database, or multiple databases. You can click Select All in the lower-left corner of the Available section to select all databases. The supported backup objects vary based on the database types. For more information, see Database engines and features.

    • By default, a backup schedule cannot be used to back up a database that is created after the backup schedule is created. To back up the database, you can add the database to the backup schedule on the Configure Task page of the backup schedule. For more information, see Modify backup objects.

  7. In the Configure Backup Time step, configure the parameters that are described in the following table. Then, click Next in the lower-right corner of the page.

    Parameter

    Description

    Full-scale Backup Frequency

    The frequency of the backup schedule. Valid values: Periodic Backup and Single Backup.

    Note

    If you select Periodic Backup, you must configure the Full Data Backup Recurrence and Start At parameters.

    Full Data Backup Recurrence

    The days of the week on which DBS runs the backup schedule. You can select one or more days of a week. Select at least one day of the week.

    Start At

    The start time of the backup. We recommend that you set a point in time within off-peak hours. Example: 01:00.

    Note

    If a previous full data backup is not finished at the start time of the next backup, DBS skips the next backup.

    Incremental Backup

    Specifies whether to enable incremental backup.

    This parameter is displayed only if you set the Full-scale Backup Frequency parameter to Periodic Backup.

    Maximum Concurrent Threads for Full Data Backup

    The maximum number of concurrent threads available for a full backup. You can set this parameter to adjust the backup speed. For example, you can reduce the number of backup threads to minimize impacts on the database.

    The maximum number of actual concurrent threads varies based on backup schedule specifications. For more information, see How do I change the maximum backup speed?

    Maximum Speed for Full Data Backup

    The maximum speed for full data backup. This parameter helps efficiently reduce the impact of backup on the single-thread performance of the Redis instance. You can use the default value. Unit: KB/s.

  8. In the Edit Lifecycle step, configure the lifecycle for full backup data in the Configure Full Data Backup Lifecycle section.

    If you set the Incremental Backup parameter to Enable in Step 6, you must configure the lifecycle for incremental backup data. For more information about the lifecycle rules of backup data, see How do I manage the lifecycle rules of backup sets?

  9. After the preceding configurations are complete, click Precheck in the lower-right corner of the page.

  10. If the Precheck Passed message appears, click Start Task.

    Note
    • If the state of the backup schedule changes to Running, the backup schedule takes effect.

    • If an exception or error occurs when you start the backup schedule, troubleshoot the exception or error at the earliest opportunity. For more information, see How do I fix errors for an abnormal backup schedule in DBS? If your issue persists after you use the solution that is provided in the preceding topic, contact technical support in the DBS DingTalk group (ID: 35585947).

Step 2: Restore the backup data in DBS to ApsaraDB for Redis

Restore the backup set generated in Step 1 to an ApsaraDB for Redis instance. For more information about how to create an ApsaraDB for Redis instance, see Step 1: Create an ApsaraDB for Redis instance.

  1. On the Backup Schedules page, click the ID of the backup schedule created in Step 1 to go to its details page.

  2. In the left-side navigation pane, choose Backup Tasks > Full Data. In the upper-right corner of the page, click Restore Database.

  3. In the Set Time Restored To step of the Create Restore Task wizard, configure the parameters and click Next. The following table describes the parameters.

    image

    Section

    Parameter

    Description

    N/A

    Task Name

    The name of the restore task. DBS automatically generates a task name. We recommend that you specify a name that can help you identify the task. Task names do not need to be unique.

    Set Time Restored To

    Time Range Available to Restore

    The time range from the point in time when the first full backup set is created to the point in time when the latest full backup set is created. The database can be restored to a point in time within the time range.

    Restore To

    The point in time to which you want to restore the source database. The value must be within the time range that is specified by the Time Range Available to Restore parameter.

    Note
    • If the incremental backup feature is enabled, DBS allows you to restore the data to a point in time from the completion of the first full backup to the completion of the last incremental backup.

    • If the incremental backup feature is disabled, DBS allows you to restore the data to a point in time when a full backup is complete.

    Configure Destination Database

    Database Location

    The location of the destination database to which you want to restore the source database. Select ApsaraDB for Redis.

    Instance Region

    The region in which the destination database resides.

    Database Type

    The type of the destination database. Default value: Redis.

    Redis Instance ID

    The ID of the ApsaraDB for Redis instance to which you want to restore data.

    Password

    The password of the database account that is used to log on to the destination database.

    Compliance warranty regarding cross-border data transfers

    Read the statement of compliance and select I have read and agree to the preceding compliance commitment.

  4. In the Configure Objects to Restore step, configure the parameters that are described in the following table and click Precheck.

    Parameter or setting

    Description

    Conflict Handling

    By default, Rename Object with the Same Name is selected for the Conflict Handling parameter. For example, if the job_info table to be restored shares the same name with a table in the destination database, the system renames the restored table in the following format: job_info_dbs_<Restore task ID>_<Timestamp>.

    Objects to Restore

    Select the database or table that you want to restore in the Available section and click the rightwards arrow to add it to the Selected section.

    Note

    DBS allows you to restore some databases by database or table. This reduces the amount of data to be restored and shortens the recovery time objective (RTO). For more information about the supported restoration granularity, see Database engines and features.

  5. If the Precheck Passed message appears in the Precheck dialog box, click Start Task.

    To view the database restoration progress, click Restore Tasks in the left-side navigation pane.

    Note

    The restoration duration depends on the specifications of the backup schedule and the size of the database to be restored. The restoration duration is shorter for a backup schedule with higher specifications. For more information, see Performance tests on backup and restoration.

Step 3: Change the DBS backup source to the ApsaraDB for Redis instance

After your application is switched to ApsaraDB for Redis, you do not need to unsusbscribe from DBS. You can change the DBS backup source from the self-managed Redis database to the ApsaraDB for Redis instance to perform data-related operations such as data archiving and geo-redundancy.

  1. On the Backup Schedules page. click the ID of the backup schedule to go to its details page. In the Basic Information section, click Edit Backup Source to change the backup source.

    image

  2. In the Backup Source Information section, set the Database Location parameter to ApsaraDB for Redis, select the destination ApsaraDB for Redis instance from the Redis Instance ID drop-down list, enter the password, and then click Next.

    image

  3. Click Select All in the lower part of the Available section to move all objects to the Selected section. Click Save.

    The backup source is changed. Then, DBS backs up data of the ApsaraDB for Redis instance that you select for the backup schedule.

What to do next

  • You can also directly create, start, or view a restoration task by calling an API operation. For more information, see CreateRestoreTask, StartRestoreTask, or DescribeRestoreTaskList.

  • If the backup data at the specified point in time does not meet your business requirements, you can click Start Full Data Backup in the upper-right corner of the Full Data page to manually back up the database. After the backup is complete, configure a restoration task to restore the database to the point in time of the latest full backup.

  • If an exception or error occurs in the restoration task, refer to Common Errors and Troubleshooting for troubleshooting.