Skip to content

Commit 3047c2d

Browse files
Josipmrdenmatea16
andauthored
Add restore snapshot better explanation (#1257)
Co-authored-by: Matea Pesic <[email protected]>
1 parent 45fade1 commit 3047c2d

File tree

1 file changed

+27
-9
lines changed

1 file changed

+27
-9
lines changed

pages/database-management/backup-and-restore.mdx

+27-9
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,37 @@ Follow these steps to create database backup:
7171

7272
## Restore data
7373

74-
Issue the following command from an already running Memgraph instance:
74+
To restore a snapshot in Memgraph, run the following command from an already running instance:
7575

7676
```
77-
RECOVER SNAPSHOT "/path/to/snapshot" [FORCE];
77+
RECOVER SNAPSHOT "/path/to/snapshot";
7878
```
7979

80-
The query will try to copy the defined file into the local data directory and
81-
apply the snapshot. It is advised to define an absolute file path. A relative
82-
path would have to be in relation to the Memgraph execution path. Before
83-
modifying the local data directory, all WALs and snapshots will be moved to a
84-
hidden directory: .old_*time-since-epoch*. The query must contain the `FORCE` flag
85-
if the instance has not been freshly started. That will clear all data before
86-
applying the snapshot.
80+
By default, snapshots are stored in the local directory:
81+
`/var/lib/memgraph/snapshots/`
82+
83+
If your snapshot is stored elsewhere, Memgraph will attempt to copy it to the local snapshot directory.
84+
Ensure the file has the necessary permissions to be moved. If not, you might encounter the following error:
85+
86+
```output
87+
Failed to copy snapshot over to local snapshots directory.
88+
```
89+
90+
Use an absolute path when specifying the snapshot location. If you provide a relative path, it must be relative
91+
to the Memgraph execution path.
92+
93+
Before modifying the local data directory, Memgraph will move all existing WALs and snapshots to a hidden
94+
directory in the format:
95+
`.old_<time-since-epoch>`
96+
97+
If the instance is not freshly started, add the `FORCE` flag to your command:
98+
99+
```
100+
RECOVER SNAPSHOT "/path/to/snapshot" FORCE;
101+
```
102+
103+
This will clear all existing data before applying the snapshot.
104+
87105

88106
In order to query the snapshots currently present in the local data directory,
89107
execute the query:

0 commit comments

Comments
 (0)