diff --git a/docs-2.0-en/backup-and-restore/3.manage-snapshot.md b/docs-2.0-en/backup-and-restore/3.manage-snapshot.md index 3372435760e..fbf80b7a974 100644 --- a/docs-2.0-en/backup-and-restore/3.manage-snapshot.md +++ b/docs-2.0-en/backup-and-restore/3.manage-snapshot.md @@ -14,23 +14,7 @@ If authentication is enabled, only the GOD role user can use the snapshot featur * NebulaGraph cannot automatically delete the invalid files created by a failed snapshot task. You have to manually delete them by using [`DROP SNAPSHOT`](#delete_snapshots). -* Customizing the storage path for snapshots is not supported for now. The default path is `/usr/local/nebula/data`. - -## Snapshot form and path - -NebulaGraph snapshots are stored in the form of directories with names like `SNAPSHOT_2021_03_09_08_43_12`. The suffix `2021_03_09_08_43_12` is generated automatically based on the creation time (UTC). - -When a snapshot is created, snapshot directories will be automatically created in the `checkpoints` directory on the leader Meta server and each Storage server. - -To fast locate the path where the snapshots are stored, you can use the Linux command `find`. For example: - -```bash -$ find |grep 'SNAPSHOT_2021_03_09_08_43_12' -./data/meta2/nebula/0/checkpoints/SNAPSHOT_2021_03_09_08_43_12 -./data/meta2/nebula/0/checkpoints/SNAPSHOT_2021_03_09_08_43_12/data -./data/meta2/nebula/0/checkpoints/SNAPSHOT_2021_03_09_08_43_12/data/000081.sst -... -``` +* Customizing the storage path for snapshots is not supported for now. ## Create snapshots @@ -38,7 +22,7 @@ Run `CREATE SNAPSHOT` to create a snapshot for all the graph spaces based on the !!! note - If the creation fails, [delete the snapshot](#delete_snapshots) and try again. + If the creation fails, refer to the later section to delete the corrupted snapshot and then recreate the snapshot. ```ngql nebula> CREATE SNAPSHOT; @@ -66,6 +50,21 @@ The parameters in the return information are described as follows. | `Status` | The status of the snapshot. `VALID` indicates that the creation succeeded, while `INVALID` indicates that it failed. | | `Hosts` | IP addresses and ports of all Storage servers at the time the snapshot was created. | +### Snapshot path + +Snapshots are stored in the path specified by the `data_path` parameter in the Meta and Storage configuration files. When a snapshot is created, the `checkpoints` directory is checked in the datastore path of the leader Meta service and all Storage services for the existence, and if it is not there, it is automatically created. The newly created snapshot is stored as a subdirectory within the `checkpoints` directory. For example, `SNAPSHOT_2021_03_09_08_43_12`. The suffix `2021_03_09_08_43_12` is generated automatically based on the creation time (UTC). + +To fast locate the path where the snapshots are stored, you can use the Linux command `find` in the datastore path. For example: + +```bash +$ cd /usr/local/nebula-graph-ent-{{nebula.release}}/data +$ find |grep 'SNAPSHOT_2021_03_09_08_43_12' +./data/meta2/nebula/0/checkpoints/SNAPSHOT_2021_03_09_08_43_12 +./data/meta2/nebula/0/checkpoints/SNAPSHOT_2021_03_09_08_43_12/data +./data/meta2/nebula/0/checkpoints/SNAPSHOT_2021_03_09_08_43_12/data/000081.sst +... +``` + ## Delete snapshots To delete a snapshot with the given name, run `DROP SNAPSHOT`. @@ -86,6 +85,10 @@ nebula> SHOW SNAPSHOTS; +--------------------------------+---------+------------------+ ``` +!!! note + + Deleting the only snapshot within the `checkpoints` directory also deletes the `checkpoints` directory. + ## Restore data with snapshots !!! warning @@ -94,7 +97,7 @@ nebula> SHOW SNAPSHOTS; Currently, there is no command to restore data with snapshots. You need to manually copy the snapshot file to the corresponding folder, or you can make it by using a shell script. The logic implements as follows: -1. After the snapshot is created, the `checkpoints` directory is generated in the installation directory of the leader Meta server and all Storage servers, and saves the created snapshot. Taking this topic as an example, when there are two graph spaces, the snapshots created are saved in `/usr/local/nebula/data/meta/nebula/0/checkpoints`, `/usr/local/nebula/data/storage/ nebula/3/checkpoints` and `/usr/local/nebula/data/storage/nebula/4/checkpoints`. +1. After the snapshot is created, the `checkpoints` directory is generated in the installation directory of the leader Meta service and all Storage services, and saves the created snapshot. Taking this topic as an example, when there are two graph spaces, the snapshots created are saved in `/usr/local/nebula/data/meta/nebula/0/checkpoints`, `/usr/local/nebula/data/storage/ nebula/3/checkpoints` and `/usr/local/nebula/data/storage/nebula/4/checkpoints`. ```bash $ ls /usr/local/nebula/data/meta/nebula/0/checkpoints/ @@ -109,7 +112,7 @@ Currently, there is no command to restore data with snapshots. You need to manua !!! warning - The data and wal directories of all Meta servers should be overwritten at the same time. Otherwise, the new leader Meta server will use the latest Meta data after a cluster is restarted. + The data and wal directories of all Meta services should be overwritten at the same time. Otherwise, the new leader Meta service will use the latest Meta data after a cluster is restarted.