Help Center> Document Database Service> User Guide> Data Backups> Backup Principles and Solutions
Updated on 2024-04-01 GMT+08:00

Backup Principles and Solutions

DDS instances support automated and manual backups. You can periodically back up databases. If a database is faulty or data is damaged, you can restore the database using backup files to ensure data reliability.

Backup Principles

  • Cluster instance

    A cluster instance consists of a config node, and multiple dds mongos and shard nodes. The config node is used to store the configuration information of a cluster instance, and the shard node is used to store data of a cluster instance. Backing up a cluster instance means that data on the config and shard nodes is backed up separately. As shown in Figure 1, the config and shard nodes in a cluster instance are backed up to their own hidden nodes. The backup process occupies certain CPU and memory resources of the hidden nodes. During the backup, the CPU usage, memory usage, and primary/standby delay of the hidden node increase slightly, which is normal. The backup files on the hidden nodes will then be compressed and stored in OBS, and the storage space of the instance will not be occupied.

    Figure 1 Cluster backup principle
  • Replica set instance

    As shown in Figure 2, replica set instance data is backed up on hidden nodes. The backup process occupies certain CPU and memory resources of the hidden node. During the backup, the CPU usage, memory usage, and primary/standby delay of the hidden node increase slightly, which is normal. The backup files on the hidden nodes will then be compressed and stored in OBS, and the storage space of the instance will not be occupied.

    Figure 2 Replica set backup principle
  • Single node instance:

    Single-node instance backup is performed on only one node. The backup file is stored in OBS as a package, which does not occupy the storage of the instance.

    A single node instance is backed up using mongodump. During the backup, CPU and memory resources of the node are occupied. If the resources are insufficient, the backup fails. You are advised to migrate the single-node instance data to a replica set instance for backup.

    Figure 3 Single-node instance backup principle

Backup and Restoration Solution

  • Table 1 describes how to back up and download backup files.

    By default, all DDS versions 3.2, 3.4, 4.0, 4.2, and 4.4 are supported unless otherwise specified.

    Table 1 Backup solutions

    Task Type

    Method

    Instance Type and Version

    Scenario

    Backing up data

    Automated backup

    • Cluster
    • Replica set
    • Single node

    You can perform automated backup for DDS instances on the management console.

    Incremental backup

    • Cluster (versions 4.0 and 4.2)
    • Replica set (versions 4.0 and 4.2)

    You can perform incremental backup for DDS instances on the management console.

    Cross-Region Backup

    • Cluster
    • Replica set
    • Single node

    You can perform cross-region backup on the DDS console.

    Manual backup

    • Cluster
    • Replica set
    • Single node

    You can perform manual backup for DDS instances on the management console.

    mongodump

    • Cluster
    • Replica set
    • Single node

    You can use the backup and restoration tool provided by the MongoDB client to back up your self-built MongoDB database or MongoDB database on the cloud.

    mongoexport

    • Cluster
    • Replica set
    • Single node

    You can use the backup and restoration tool provided by the MongoDB client to back up your self-built MongoDB database or MongoDB database on the cloud.

    Downloading a backup file

    OBS Browser+

    • Cluster
    • Replica set
    • Single node

    If the size of a backup file is greater than 400 MB, use OBS Browser+ to download the file.

    Browser

    • Replica set
    • Single node

    You can directly download backup files using a browser.

    URL

    • Cluster
    • Replica set
    • Single node

    You can download backup files in a new browser window, or using Xunlei or Wget.

  • For details about the DDS restoration scheme, see Solutions.