Use BR to back up data¶
After the BR is compiled, 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 BR is compiled. For more information, see Compile BR.
- The NebulaGraph services are running.
- The nebula-agent has been downloaded and the nebula-agent service is running on each host in the cluster.
-
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¶
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.
$ ./bin/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
127.0.0.1:9559
, and save the backup file to/home/nebula/backup/
.Caution
If there are multiple metad addresses, you can use any one of them.
$ ./bin/br backup full --meta "127.0.0.1:9559" --storage "local:///home/nebula/backup/"
-
Run the following command to perform a full backup for the entire cluster whose meta service address is
127.0.0.1:9559
, and save the backup file tobackup
in thebr-test
bucket of the object storage service compatible with S3 protocol.$ ./bin/br backup full --meta "127.0.0.1:9559" --s3.endpoint "http://127.0.0.1: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. |
-name |
string | Yes | None | The name of backup. |
--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.