Skip to content

Commit 102d998

Browse files
committed
docs: Add usage instructions for graphman dump and restore
1 parent 115e657 commit 102d998

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

docs/dump.md

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,62 @@ in the dump. This can lead to very long restore times for large subgraphs.
2323
The restore process will be optimized in the future to only create indexes
2424
that are present in the dump's metadata.
2525

26+
### Usage
27+
28+
#### Dumping a deployment
29+
30+
```bash
31+
graphman dump <deployment> <directory>
32+
```
33+
34+
`<deployment>` identifies the subgraph deployment to dump. It can be a
35+
subgraph name, a deployment hash (`Qm...`), or a database namespace
36+
(`sgdNNN`). `<directory>` is the path where the dump will be written; it
37+
will be created if it does not exist.
38+
39+
Running `graphman dump` against an existing dump directory performs an
40+
**incremental dump**: only rows added since the last dump are exported, and
41+
new chunk files are appended rather than rewriting existing ones.
42+
43+
```bash
44+
# Full dump
45+
graphman dump my-subgraph /backups/my-subgraph
46+
47+
# Incremental update of the same dump
48+
graphman dump my-subgraph /backups/my-subgraph
49+
```
50+
51+
#### Restoring a deployment
52+
53+
```bash
54+
graphman restore <directory> [options]
55+
```
56+
57+
`<directory>` is the path to a dump previously created with `graphman
58+
dump`.
59+
60+
| Option | Description |
61+
| ----------- | --------------------------------------------------------------------------------------------------- |
62+
| `--shard` | Target database shard. Uses deployment rules (or primary shard) when omitted. Required with `--add` |
63+
| `--name` | Subgraph name for deployment rule matching and node assignment. Falls back to an existing name |
64+
| `--replace` | Drop and recreate if the deployment already exists in the target shard |
65+
| `--add` | Create a copy in a shard that doesn't already have this deployment (requires `--shard`) |
66+
| `--force` | Replace if the deployment exists in the target shard, add if it doesn't |
67+
68+
`--replace`, `--add`, and `--force` are mutually exclusive. When none is
69+
given, restore fails if the deployment already exists in the target shard.
70+
71+
```bash
72+
# Restore into the default shard
73+
graphman restore /backups/my-subgraph
74+
75+
# Restore into a specific shard, replacing if it already exists
76+
graphman restore /backups/my-subgraph --shard shard1 --replace
77+
78+
# Force-restore (replace or add as needed)
79+
graphman restore /backups/my-subgraph --force
80+
```
81+
2682
### Directory layout
2783

2884
A dump directory has the following structure:

0 commit comments

Comments
 (0)