All Products
Search
Document Center

Use DBS to back up an ApsaraDB RDS for PostgreSQL instance

Last Updated: Jul 15, 2020

Database Backup (DBS) can meet your requirements of restoring single tables, backing up ApsaraDB RDS for PostgreSQL instances from one region to another, and archiving backup data for a long term.

Click here to activate DBS>>.

Features

Feature Description
SQL file backup DBS uses the logical backup technology to store backup data in SQL or CSV files.
Backup data query DBS allows you to use SQL statements to query backup sets without restoring data. For more information, see Use SQL statements to query backup sets.
Remote backup DBS supports backing up a PostgreSQL instance to an Object Storage Service (OSS) bucket in the destination region. When necessary, you can restore the backup data to a PostgreSQL instance in the destination region, source region, or any other regions.
Long-term archiving DBS supports retaining backup files for up to five years, after which the backup set will be automatically transferred to Archive Storage.
Fine-grained backup DBS supports backing up a single table, a single database, multiple databases, or an entire PostgreSQL instance.
Backup speed limit DBS allows you to limit the backup speed to significantly reduce the negative impact of backup operations on the performance of the database.
Single-table restore DBS supports restoring a single table without restoring the entire PostgreSQL instance. This reduces the time required for data restore.

Procedure

Create a backup schedule

  1. Log on to the DBS console.
  2. Click Create Schedule in the upper-right corner to go to the DBS purchase page.
  3. Set the parameters as described in the following table and click Buy Now.

    Section Parameter Description
    Basic DBS Region The region where the DBS instance to be purchased resides.
    Make sure that the selected region is the same as the region where you want to store the backup data.
    Database Type The type of the database to be backed up. In this topic, select PostgreSQL.
    Specification The type of the DBS instance to be purchased. For more information, see How to select DBS instances.
    Backup Method The method used to back up the ApsaraDB RDS for PostgreSQL instance. Currently, only logical backup is supported for ApsaraDB RDS for PostgreSQL instances.
    Storage Size The storage size of the DBS instance to be purchased. You do not need to specify the storage size when you purchase a DBS instance. The instance is charged in the pay-as-you-go mode. You can also purchase a storage package. A favorable discount is available if you purchase a large storage package.
    Purchase Plan Quantity The number of DBS instances to be purchased. Set this parameter based on your actual needs.
    Duration The validity period of the purchased DBS instance. Set this parameter based on your actual needs.
  4. On the Confirm Order page, confirm your order information, read and select the DBS Agreement of Service check box, and then click Pay.

  5. After you pay for the order, you can log on to the DBS console and click Backup Schedules in the left-side navigation pane to view the new backup schedule.

Configure the backup schedule

  1. Log on to the DBS console.
  2. In the left-side navigation pane, click Backup Schedules.
  3. On the Backup Schedules page that appears, find the target backup schedule and click Configure Backup Schedule in the Actions column.
    Backup schedules
  4. In the Configure Backup Source and Destination step, configure the backup source and destination.

    Section Parameter Description
    - Schedule Name The name of the backup schedule. DBS automatically generates a schedule name. We recommend that you specify an informative name for easy identification. You do not need to use a unique schedule name.
    Backup Source Information Backup Mode The method used to back up the ApsaraDB RDS for PostgreSQL instance. Currently, only logical backup is supported for ApsaraDB RDS for PostgreSQL instances.
    Backup Gateway The backup gateway. For more information, see Add a backup gateway.
    Database Location The location of the database to be backed up. Valid values:
    • User-Created Database with Public IP Address
    • ECS-Hosted Database
    • RDS Instance
    • Express Connect DB/VPN Gateway/Intelligent Gateway
    • POLARDB Instance
    • No public network IP: Port’s self-built database (accessed through the database gateway)
    Database Type The type of the database to be backed up. The default value is the database type that you specified when you created the backup schedule.
    If you set Database Location to RDS Instance, this parameter is unavailable. Instead, the RDS Instance ID parameter appears.
    Instance Region The region where the instance to be backed up resides.
    This parameter is available only when you set Database Location to ECS-Hosted Database, RDS Instance, or POLARDB Instance.
    Address The public endpoint used to connect to the database to be backed up.
    This parameter is available only when you set Database Location to User-Created Database with Public IP Address or Express Connect DB/VPN Gateway/Intelligent Gateway.
    Port Number The port used to connect to the database to be backed up.
    This parameter is available only when you set Database Location to User-Created Database with Public IP Address , ECS-Hosted Database, or Express Connect DB/VPN Gateway/Intelligent Gateway.
    ECS Instance ID The ID of the Elastic Compute Service (ECS) instance to be backed up.
    This parameter is available only when you set Database Location to ECS-Hosted Database.
    RDS Instance ID The ID of the ApsaraDB RDS for PostgreSQL instance to be backed up.
    This parameter is available only when you set Database Location to RDS Instance.
    Peer VPC The Virtual Private Cloud (VPC) where the database to be backed up resides.
    This parameter is available only when you set Database Location to Express Connect DB/VPN Gateway/Intelligent Gateway.
    Database Account The account used to log on to the ApsaraDB RDS for PostgreSQL instance.
    Password The password used to log on to the ApsaraDB RDS for PostgreSQL instance.
    After you specify the source database information, click Test Connection next to Password to check whether the information is correct. 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 source database information based on the check results.
    SSL Encryption Specifies whether to encrypt the connection through Secure Sockets Layer (SSL). Valid values: Non-encrypted and SSL-encrypted. To select SSL-encrypted, enable SSL encryption for the ApsaraDB RDS for PostgreSQL instance first.
    Backup Destination Information Backup Storage Type The type of the storage used to back up data. Valid values:
    • DBS built-in storage
    • OSS for user
    OSS Bucket name The name of your OSS bucket.
    This parameter is available only when you set Backup Storage Type to OSS for user.
    Storage Encryption The method used to encrypt the stored data. Valid values:
    • Non-encrypted
    • Encrypted
    • KMS Encrypted
    configure backup schedule PostgreSQL

  5. In the lower-right corner of the page, click Next.

  6. In the Edit Backup Objects step, find the database or table to be backed up in the Available section, click the rightwards arrow to add the selected database or table to the Selected section, and then click Next.

    If you back up an entire database, permission data and stored procedures will also be backed up.

  7. In the Configure Backup Time step, set the parameters as described in the following table and click Next.

    Parameter Description
    Full-scale Backup Frequency The frequency of the backup schedule. Valid values: Periodic Backup and Single Backup.
    Full Data Backup Recurrence The day in a week on which DBS runs the backup schedule.
    Full Data Backup Start At The start time of the backup.
    If the time taken for a full data backup is longer than the backup interval, DBS skips the next backup.
    Real-Time Transaction Log Backup Specifies whether to back up real-time transaction logs. Select Disable for an ApsaraDB RDS for PostgreSQL instance.
    Maximum Concurrent Threads for Full Data Backup The maximum number of concurrent threads available for a full data backup.
    The value varies with the specifications of the DBS instance that you purchased when you created the backup schedule.
  8. In the Configure Full Data Backup Lifecycle step, configure the lifecycle for a full data backup.

  9. After the configuration is completed, click Precheck in the lower-right corner of the page.

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

  11. When the status of the backup schedule changes to Running, the backup schedule takes effect.

View the backup schedule

  1. Log on to the DBS console.
  2. In the left-side navigation pane, click Backup Schedules.
  3. On the Backup Schedules page that appears, find the target backup schedule and click Manage in the Actions column.

  4. On the Configure Task page, view the basic information and running status of the backup schedule.

  5. In the left-side navigation pane, choose Backup Tasks > Full Data to view information about all full data backups.
    full data

Restore a PostgreSQL schedule

  1. Log on to the DBS console.
  2. In the left-side navigation pane, click Backup Schedules.
  3. On the Backup Schedules page that appears, find the target backup schedule and click Manage in the Actions column.
  4. On the Configure Task page that appears, click Restore Database in the upper-right corner.
  5. In the Set Time Restored To step in the Create Restore Task wizard, set the parameters as described in the following table and click Next.

    In this example, DBS will restore backup sets on an ApsaraDB RDS for PostgreSQL instance to a new instance.

    Section Parameter Description
    - Task Name The name of the restore task. DBS automatically generates a task name. We recommend that you specify an informative name for easy identification. You do not need to use a unique task name.
    Set Time Restored To Time Range Available to Restore The time range available for restoring backup sets. DBS displays the available time range automatically.
    Restore To The time point that you want to restore the source instance to. The value must be within the time range specified by Time Range Available to Restore.
    Configure Destination Database DB Instance Mode The type of the destination instance to which you want to restore backup sets. Valid values: New(Recommend) and Use Exists.
    Database Location The location of the new instance. In this example, set this parameter to RDS Instance.
    Instance Region The region where the new instance resides.
    VPC The VPC where the new instance resides.
    DB InstanceClass The specification of the new instance. Select a specification available from the drop-down list.
    We recommend that you select a specification that is equal to or larger than that of the source instance.
    Storage Space(GB) The storage space of the new instance. Select a value available from the drop-down list.

    create restore task

  6. In the Configure Objects to Restore step in the Create Restore Task wizard, set the parameters as described in the following table and click Precheck.

    Parameter Description
    Conflict Handling The method used to handle a name conflict. Valid values: Fail When Object with the Same Name Exists and Rename Object with the Same Name.
    If you select Rename Object with the Same Name, DBS renames the object as follows: For example, if the table named job_info already exists, DBS automatically renames the new table as job_info_dbs_<Restore task ID>_</Timestamp> by default.
    Objects to Restore Select the database or table to restore in the Available section and click the rightwards arrow to add it to the Selected section.
  7. If the Precheck Passed message appears, click Start Task.**