Skip to content

Restore data with BR (Enterprise Edition)

For the backed-up NebulaGraph data with the BR tool, you can restore the data. This topic describes how to restore data from backup files.

Notes

  • After the data restoration is executed successfully, the existing data on the target cluster will be deleted and then replaced with the data in the backup directory. It is recommended to back up the data on the target cluster in advance.
  • There will be a period of NebulaGraph service unavailability for data restoration, so it is recommended to operate during the low business peak period.

Prerequisites

  • No application is connected to the target NebulaGraph cluster.
  • Make sure the number of the storage servers in the original cluster is the same as that in the target cluster.

Steps

In the BR Enterprise Edition installation directory, follow these steps:

  1. View backup files.

    • List the backup files in a local path.

      ./br show --storage local://<storage_path>
      

      For example, you can view the backup files in the local /backup/ path with the following command.

      ./br show --storage "local:///backup/"
      +----------------------------+---------------------+------------------------+-------------+------------+----------------------------+
      |            NAME            |     CREATE TIME     |         SPACES         | FULL BACKUP | ALL SPACES |      BASE BACKUP NAME      |
      +----------------------------+---------------------+------------------------+-------------+------------+----------------------------+
      | BACKUP_2022_08_11_06_12_43 | 2022-08-11 06:12:43 | basketballplayer       | true        | true       |                            |
      | BACKUP_2022_08_11_08_27_14 | 2022-08-11 08:27:15 | basketballplayer,br    | false       | true       | BACKUP_2022_08_11_06_12_43 |
      
    • Lists backups in / under the nebula-br-test bucket of the S3 protocol-compliant object storage service.

      ./br show --s3.access_key QImbbGDjfQEYxxxx --s3.secret_key dVSJZfl7tnoFq7Z5zt6sfYnvi63bxxxx  --s3.region us-east-1 --storage s3://nebula-br-test/ --s3.endpoint http://192.168.8.xxx:9000/
      
  2. Restore data.

    • Restore data based on local backups.

      ./br restore full --meta <ip_address> --storage <storage_path> --name <backup_name>
      

      For example, restore the BACKUP_2022_08_11_09_11_07 file data from the local /backup/ path to the cluster with the meta address 192.168.8.129:9559:

      ./br restore full --meta "192.168.8.129:9559" --storage "local:///backup/" --name BACKUP_2022_08_11_09_11_07
      
    • Restore data based on cloud backups.

      Restore the BACKUP_2022_08_12_07_37_02 backup data from the / path under the nebula-br-test bucket of the S3-compliant object storage service to the cluster with the meta address 192.168.8.129:9559, and specify the restoration log path.

      ./br restore full --meta 192.168.8.129:9559 --s3.accesskey QImbbGDjfQEYxxxx --s3.secretkey dVSJZfl7tnoFq7Z5zt6sfYnvi63bxxxx  --s3.region us-east-1 --storage s3://nebula-br-test/ --s3.endpoint http://192.168.8.xxx:9000/ --log "3.log" --name BACKUP_2022_08_12_07_37_02
      

    If the following information is returned, the data is restored successfully.

    Restore succeed.
    

    Note

    If the data restoration fails, BR Enterprise Edition automatically performs a rollback and the cluster's data is automatically recovered back to the pre-restoration data.

  3. Run the following command to clean temporary files. This command will clean up temporary files in the cluster or external storage, and you can also use this command to clean up old backup directories. The example is as follows.

    Note

    By default, BR automatically cleans up the temporary files when an error occurs during data restoration. If the automatic cleanup fails, you need to execute the command to clean up the temporary files manually.

    • Clear a local backup directory.

      ./br cleanup --meta 192.168.8.129:9559 --storage "local:///backup/" --name BACKUP_2022_08_11_09_11_07
      
    • Clear the backup directory in the cloud storage service.

      ./br cleanup --meta 192.168.8.129:9559 --s3.accesskey QImbbGDjfQEYxxxx --s3.secretkey dVSJZfl7tnoFq7Z5zt6sfYnvi63bxxxx  --s3.region us-east-1 --storage s3://nebula-br-test/ --s3.endpoint http://192.168.8.xxx:9000/ --name BACKUP_2022_08_12_07_37_02
      

Options

The following options are for data restorations.

Option Data type Required Default value Description
-h,-help - No - View more information about BR commands.
--debug - No None View more information for BR logs.
--log string No "br.log" The path of BR logs.
--concurrency int No None Used to control the number of concurrent file downloads during data restoration. The default value is 5.
--meta string Yes None The IP address and port number of any Meta service in the cluster.
--name string Yes None The name of the backup file.
--storage string Yes None The storage URL of the backup is to be restored. The format is <schema>://<storage_path>.
schema: Two options, s3 and local.
When schema is s3, you still need to add options of s3.access_keys3.endpoints3.region, and s3.secret_key.
<storage_path>: The storage path of the backup to be restored.
--s3.access_key string No None The Access Key ID that is used to identify a user.
--s3.endpoint string No None The S3 endpoint URL. You need to specify the HTTP or HTTPS scheme explicitly.
--s3.region string No None The physical location of a data center.
--s3.secret_key string No None The Access Key Secret that is used to verify the identity of the user.

Last update: February 19, 2024