Skip to content

Use BR to back up data

After the BR is installed, you can back up data of the entire graph space. This topic introduces how to use the BR to back up data.

Prerequisites

To back up data with the BR, do a check of these:

  • The NebulaGraph services are running.
  • If you store the backup files locally, create a directory with the same absolute path on the meta servers, the storage servers, and the BR machine for the backup files and get the absolute path. Make sure the account has write privileges for this directory.

    Note

    In the production environment, we recommend that you mount Network File System (NFS) storage to the meta servers, the storage servers, and the BR machine for local backup, or use Amazon S3 or Alibaba Cloud OSS for remote backup. When you restore the data from local files, you must manually move these backup files to a specified directory, which causes redundant data and troubles. For more information, see Restore data from backup files.

Procedure

In the BR installation directory (the default path of the compiled BR is ./bin/br), run the following command to perform a full backup for the entire cluster.

Note

Make sure that the local path where the backup file is stored exists.

$ ./br backup full --meta <ip_address> --storage <storage_path>

For example:

  • Run the following command to perform a full backup for the entire cluster whose meta service address is 192.168.8.129:9559, and save the backup file to /home/nebula/backup/.

    Caution

    If there are multiple metad addresses, you can use any one of them.

    Caution

    If you back up data to a local disk, only the data of the leader metad is backed up by default. So if there are multiple metad processes, you need to manually copy the directory of the leader metad (path <storage_path>/meta) and overwrite the corresponding directory of other follower meatd processes.

    $ ./br backup full --meta "192.168.8.129:9559" --storage "local:///home/nebula/backup/"
    
  • Run the following command to perform a full backup for the entire cluster whose meta service address is 192.168.8.129:9559, and save the backup file to backup in the br-test bucket of the object storage service compatible with S3 protocol.

    $ ./br backup full --meta "192.168.8.129:9559" --s3.endpoint "http://192.168.8.129:9000" --storage="s3://br-test/backup/" --s3.access_key=minioadmin --s3.secret_key=minioadmin --s3.region=default
    

The parameters are as follows.

Parameter Data type Required Default value Description
-h,-help - No None Checks help for restoration.
--debug - No None Checks for more log information.
--log string No "br.log" Specifies detailed log path for restoration and backup.
--meta string Yes None The IP address and port of the meta service.
--space string Yes None (Experimental feature) Specifies the names of the spaces to be backed up. All spaces will be backed up if not specified. Multiple spaces can be specified, and format is --spaces nba_01 --spaces nba_02.
--storage string Yes None The target storage URL of BR backup data. The format is: \<Schema>://\<PATH>.
Schema: Optional values are local and s3.
When selecting s3, you need to fill in s3.access_key, s3.endpoint, s3.region, and s3.secret_key.
PATH: The path of the storage location.
--s3.access_key string No None Sets AccessKey ID.
--s3.endpoint string No None Sets the S3 endpoint URL, please specify the HTTP or HTTPS scheme explicitly.
--s3.region string No None Sets the region or location to upload or download the backup.
--s3.secret_key string No None Sets SecretKey for AccessKey ID.

Next to do

After the backup files are generated, you can use the BR to restore them for NebulaGraph. For more information, see Use BR to restore data.


Last update: December 21, 2022