All Products
Search
Document Center

Database Backup:Back up a self-managed Redis database and restore it to the cloud

Last Updated:Oct 25, 2022

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 an on-premises self-managed Redis database and restore it to the cloud. The whole process includes three steps: back up the self-managed Redis database to DBS, restore the backup data in DBS to ApsaraDB for Redis, and then change the DBS backup source to ApsaraDB for Redis.

Step 1: Back up the self-managed Redis database

  1. Log on to the DBS console.

  2. For more information about how to create backup schedules, see Purchase a backup schedule.

    Note

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

  3. In the left-side navigation pane, click Backup Schedules. In the upper-left corner of the Backup Schedules page, select a region.

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

  5. In the Configure Backup Source and Destination dialog box, configure the parameters as described in the following table and click Next.

    Section

    Parameter

    Description

    N/A

    Schedule Name

    The name of the backup schedule. DBS automatically generates a backup schedule name. We recommend that you specify a name that can help you identify the backup schedule. 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 select when you purchase the backup schedule is used. In this example, this parameter is set to Logical Backup.

    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 deployed on an Elastic Compute Service (ECS) instance. You must also set 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.

    • The default account is default. You can use the instance ID such as r-bp10noxlhcoim2**** as an account.

    • The password is in the <account>:<password> format. Both the accounts that you specify and the default account support this authentication mode.

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

    Backup Destination Information

    Backup Storage Type

    The storage type of the backup data. Select DBS Storage (recommended).

    DBS Storage (recommended): Backup data is stored in DBS without requiring you to create storage space. 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. To reduce storage costs, we recommend that you use subscription storage plans. For more information, see Use storage plans.

    Storage Encryption

    The encryption method for the backup data. Select Encrypted.

    Encrypted: recommended. DBS uses AES-256 to encrypt the stored 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, multiple databases, or an entire database instance. You can click Select All in the lower-left corner of the page to select all databases. The database objects that can be backed up 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 page, configure the parameters that are described in the following table and then click Next.

    Parameter

    Description

    Full-scale Backup Frequency

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

    Note

    If you set this parameter to Periodic Backup, you must set the Full Data Backup Recurrence, Start At, and Incremental backup parameters.

    Full Data Backup Recurrence

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

    Start At

    The start time of the backup, such as 01:00. We recommend that you set a time during off-peak hours.

    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. Enable is selected by default.

    Maximum Concurrent Threads for Full Data Backup

    During full backup, a few parallel threads are involved and the backup speed is slow. The performance of the source database is hardly impacted. Use the default value.

    Maximum Speed for Full Data Backup

    Designed to accurately control the full backup speed and effectively reduce the impact of backup on the single-thread performance of Redis. Use the default value.

  8. In the Edit Lifecycle step, configure the lifecycle for full and incremental data backup. Click Precheck.

    The full backup period is 730 days in this example. The backup data is deleted after 730 days.

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

    You are redirected to the Backup Schedules page. The backup plan status changes to Running.

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

In this example, the backup set is restored to an existing ApsaraDB for Redis instance. You must create an ApsaraDB for Redis instance in advance. For more information, see Step 1: Create an ApsaraDB for Redis instance.

  1. On the Backup Schedules page, find the backup schedule that you want to use to create a restore task, and click Manage in the Actions column. Alternatively, you can click the name of the backup schedule.

  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, configure the parameters as described in the following table and click Next.

    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 displayed next to 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 instance to which you want to restore your database. Select ApsaraDB for Redis.

    Instance Region

    The region in which the destination database instance resides.

    Database Type

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

    Redis Instance ID

    The ID of the destination ApsaraDB for Redis instance.

    Password

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

  4. In the Configure Objects to Restore step, click Select All in the lower part of the Available section to move all objects to the Selected section. Click Precheck.

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

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

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

After you back up a self-managed Redis database and restore it to an ApsaraDB for Redis instance, you do not need to release the backup schedule. You can change the DBS backup source to ApsaraDB for Redis to achieve additional benefits such as data archiving and cross-region backup.

  1. On the Backup Schedules page, find the backup schedule and click Manage in the Actions column. Alternatively, you can click the name of the backup schedule. In the Basic Information section, click Edit Backup Source to modify the backup source database.

  2. On the Backup Source Information page, set Database Location to ApsaraDB for Redis, select the Redis instance, enter the account and password, and then click Next.

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

    Then, the backup schedule can be used to back up the ApsaraDB for Redis instance.