ApsaraDB RDS for PostgreSQL: Logical backup and recovery

更新时间:
复制 MD 格式

Data Disaster Recovery (DBS) enables single-table recovery, off-site backups, and long-term archiving for PostgreSQL databases. This topic describes how to use DBS to logically back up a database from sources such as ApsaraDB RDS for PostgreSQL, PolarDB for PostgreSQL, or other PostgreSQL databases.

Limitations

  • Each DBS backup schedule can perform a logical backup of only one PostgreSQL database, such as an ApsaraDB RDS for PostgreSQL or PolarDB for PostgreSQL instance. To back up multiple databases, you must purchase a separate backup schedule for each.

  • Incremental backup is not supported for PostgreSQL databases.

Create a backup schedule

For more information, see Create a backup schedule.

Note
  • When you purchase a backup schedule, set Database Type to PostgreSQL and Logical Backup to Logical Backup.

  • For information about the PostgreSQL versions that DBS supports for logical backups, see Supported database types and features.

Configure a backup schedule

  1. Log on to the Data Management Service (DMS) 5.0 console.

  2. In the top navigation bar, choose Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Plan.

    Note

    If you use the DMS console in simple mode, move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner of the DMS console and choose All Features > Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Plan.

  3. Find the backup schedule that you want to configure and click Configure Backup Schedule in the Actions column.

  4. On the Configure Backup Source and Destination page, configure the backup source and destination, and then click Next in the lower-right corner.

    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

    RDS Instance

    Instance region

    The region in which the source database instance resides.

    Note

    This parameter is displayed only if you set the Database Location parameter to RDS Instance, PolarDB, ECS-Hosted Database, or No public network IP: Port's self-built database (accessed through the database gateway).

    PolarDB instance ID

    Select the PolarDB instance that you want to back up.

    Database name

    Enter the name of the database that you want to back up.

    Important

    DBS performs PostgreSQL logical backups at the database level. Each DBS backup schedule can back up only one database. To back up multiple databases, you must purchase a separate backup schedule for each.

    Database account

    The username of the account that is used to connect to the database that you want to back up. The account must have permissions to back up the database. For more information, see Account permissions.

    Note

    For ApsaraDB RDS databases, read-only permissions are required for backup, and read and write permissions are required for backup and restoration.

    Password

    The password of the account that is used to connect to the database that you want to back up.

    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.

    Connection method

    When the source database is an ApsaraDB RDS for PostgreSQL instance, you can set the connection method:

    • Non-encrypted

    • SSL-encrypted: Uses Secure Sockets Layer (SSL) to encrypt network connections, improving data security and integrity in transit. This may slightly increase connection response time.

      Note

      Before you select SSL-encrypted, enable SSL encryption on the RDS instance. For more information, see Configure SSL encryption.

    Data cross-border compliance commitment

    Read and agree to the compliance statement.

    Backup Destination Information

    Backup storage type

    The storage type for your backup data. Valid values:

    • DBS Built-in Storage (Recommended): Automatically stores your data in DBS built-in storage, eliminating the need to create a separate storage space. You are charged based on the amount of data stored in DBS. For more information about billing, see Billing items (DMS).

    • OSS For User: Requires you to create a bucket in Object Storage Service (OSS) beforehand. For more information, see Create buckets.

    Note
    • In this example, DBS Built-in Storage is selected. If you select User-owned OSS Bucket, you must also configure the OSS Bucket Name parameter. Only the OSS Standard storage class is supported.

    • If you have a large amount of data, purchase a DBS storage plan (subscription) to offset the fees for DBS built-in storage. Storage plans are more cost-effective than the pay-as-you-go billing method.

    Storage method

    Select a storage method. Valid values:

    • Encrypted (Recommended): Data is encrypted at rest by using the industry-standard AES-256 algorithm.

      OSS supports server-side encryption. When you upload an object, OSS encrypts the object it receives and then stores the encrypted object. When you download the object, OSS automatically decrypts it and returns the original object to you. For more information, see Server-side encryption.

    • Non-encrypted: Encryption is not enabled.

  5. On the Edit Backup Objects page, move the databases or tables that you want to back up to the Selected list, and then click Next.

    Note
    • Logical backup: You can choose to back up an entire database or specific tables during a full backup. You can click Select All in the lower-left corner to back up the entire database. For information about the specific granularity of logical backups, see Supported database types and features.

    • Physical backup: You can back up only the entire database instance.

  6. On the Configure Backup Time page, configure the backup time and other settings, and then click Next in the lower-right corner.

    Parameter

    Description

    Full 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 backup cycle

    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.

    Full backup start time

    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

    Incremental backup is not supported for PostgreSQL databases.

    Maximum concurrent threads for full 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.

  7. On the Edit Lifecycle page, enter the retention period for the full backup data in the DBS built-in storage.

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

  9. In the Precheck dialog box, click Start Task after the precheck is passed.

    Note
    • The backup schedule is successfully configured when its Status changes to Running.

    • If an exception or error occurs with the backup schedule, troubleshoot and fix the issue immediately. For more information, see How do I fix a failed DBS backup schedule? If the issue persists after you follow the suggestions, contact us in the DBS client consultation DingTalk group (ID: 35585947).

Restore data

  1. Log on to the Data Management Service (DMS) 5.0 console.

  2. In the top navigation bar, choose Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Plan.

    Note

    If you use the DMS console in simple mode, move the pointer over the 2023-01-28_15-57-17.png icon in the upper-left corner of the DMS console and choose All Features > Security and disaster recovery (DBS) > Data Disaster Recovery (DBS) > Backup Plan.

  3. On the Backup Schedules page, find the backup schedule that you want to manage and click Manage in the Actions column.

  4. On the Configure Task page, click Restore Database in the upper-right corner.

  5. On the Set Time Restored To page, configure the following parameters 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

    Recoverable time range

    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.

    Selected recovery point

    Select a recovery point from a completed full backup. The point in time must be within the Recoverable Time Range.

    Recovery destination database

    Database location

    Select a location based on your destination database type:

    • No public network IP: Port's self-built database (accessed through the database gateway): Restore a self-hosted database by using Database Gateway (DG). You must configure a database gateway for the database instance in advance and select the destination Gateway DG Instance ID.

    • User-Created Database with Public IP Address <IP Address:Port Number>: Restore a self-hosted database over a public IP address. You must also configure the endpoint and port number of the source database instance.

    • ECS-Hosted Database: Restore a database that is deployed on an ECS instance. You must also configure the ECS Instance ID of the destination instance and the database port number.

    • RDS Instance: Restore an RDS instance. You must also select the destination RDS Instance ID.

    • Express Connect DB/VPN Gateway/Intelligent Gateway: Restore a self-hosted database in a Virtual Private Cloud (VPC). You must configure a VPC for the database instance in advance and select the destination Peer VPC.

    • PolarDB: Restore a PolarDB for PostgreSQL instance. You must also select the destination PolarDB Instance ID.

    Instance region

    Select the region of the destination instance.

    RDS instance ID

    Select the ID of the destination ApsaraDB RDS for PostgreSQL instance.

    PolarDB instance ID

    Select the ID of the destination PolarDB instance.

    Database type

    The default value is PostgreSQL.

    Note

    This parameter is displayed only if you set Database Location to User-Created Database with Public IP Address <IP Address:Port Number>, PolarDB, ECS-Hosted Database, Express Connect DB/VPN Gateway/Intelligent Gateway, or No public network IP: Port's self-built database (accessed through the database gateway).

    Peer VPC

    Select the VPC.

    Note

    This parameter is displayed only if Database Location is set to Self-hosted database connected over an Express Connect circuit, VPN gateway, or Smart Access Gateway.

    ECS instance ID

    Select the ID of the ECS instance to be recovered.

    Note

    This parameter is displayed only if Database Location is set to Self-hosted database on an ECS instance.

    Gateway DG instance ID

    Select the DG instance.

    Note

    This parameter is displayed only if Database Location is set to Self-hosted database without a public endpoint (accessed by using Database Gateway).

    Connection address

    Select the connection address of the source database instance.

    Note
    • If network security settings such as a firewall are configured on your server, click Set Whitelist to obtain the IP addresses of DBS. Add the IP addresses to the allowlist of your server to ensure that DBS can access the server.

    • This parameter is displayed only if you set Database Location to No public network IP: Port's self-built database (accessed through the database gateway), Express Connect DB/VPN Gateway/Intelligent Gateway, or User-Created Database with Public IP Address <IP Address:Port Number>.

    Port

    The connection port of the destination database.

    Note

    This parameter is not displayed if you set the Database Location parameter to RDS Instance.

    Database name

    Select the name of the destination database. The backup data is written to this database.

    Database account

    Enter the account for the destination database instance. The account must have write permissions.

    Password

    The password of the account that is used to connect to the database that you want to back up.

    Data cross-border compliance commitment

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

  6. On the Configure Objects to Restore page, configure the following parameters and click Precheck in the lower-right corner.

    Parameter

    Description

    Conflict handling

    The default setting for Conflict Handling is Rename Object If Name Conflict Occurs. For example, if you restore a table named job_info and a table with the same name already exists, the system renames the new table to job_info_dbs_<Recovery Task ID>_<Timestamp>.

    Recovery objects

    In the Source Database Objects list, select the databases or tables to restore and move them to the Selected Database Objects list.

    Note

    Some databases support single-table or single-database recovery, which reduces the data volume to be restored and shortens the recovery time objective (RTO). For more information about the supported recovery granularity, see Supported database types and features.

  7. In the Precheck dialog box, click Start Task after the Precheck Passed message appears.

    You can view the progress of the database recovery on the Restore Tasks tab.

    Note

    The recovery time depends on the specifications of the backup schedule and the size of the database. The higher the specifications, the faster the recovery. For more information, see Performance test results for logical and physical backups.

Related operations

  • You can also call API operations to create, or create and start a backup schedule. For more information, see CreateBackupPlan or CreateAndStartBackupPlan.

  • To change the backup source, backup objects, or backup policy (such as the backup time or retention period) for a backup schedule, see Manage a backup schedule.

  • To understand the potential costs associated with a backup schedule, see Billing FAQ.

  • If you do not need to use a backup schedule for a period of time, you can pause it to save costs. For more information, see Pause or restart a backup schedule.