Backup and Restore
This document mainly introduces the data backup and restore function of TuGraph.
1.Data Backup
TuGraph can use the ‘lgraph_backup’ tool to backup data. The ‘lgraph_backup’ tool can backup data from a TuGraph database to another directory. It can be used as follows:
$ lgraph_backup -s {source_dir} -d {destination_dir} -c {true/false}
Details:
-s {source_dir}
specifies the directory where the database (source database) to be backed up resides.-d {destination_dir}
specifies the directory where the backup file (destination database) is stored. If the target database is not empty, ‘lgraph_backup’ prompts you whether to overwrite the database.-c {true/false}
indicates whether a compaction occurs during backup. Every compaction creates a tighter backup, but every compaction takes longer to create. This option defaults to ‘true’.
2.Data Restore
The target database {destination_dir}
obtained using the lgraph_backup
tool backs up all subgraphs of the source database {source_dir}
, but does not include the raft information of the HA cluster, thereby ensuring that the service and cluster can be successfully restarted with the backup database and the data is consistent with the source database. The following command can be used to restart the service with the backup database. When the service starts, the storage process of all subgraphs will be restored to ensure that the backup service is completely consistent with the original service.
$ lgraph_server -c lgraph.json --directory {destination_dir} -d start
Details
-d {destination_dir}
Specify the directory where the backup file (target database) is located.