Skip to content

Commit ca776cf

Browse files
authored
Document validate backup (#2768)
1 parent a57177a commit ca776cf

File tree

6 files changed

+125
-15
lines changed

6 files changed

+125
-15
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
** xref:backup-restore/online-backup.adoc[]
202202
** xref:backup-restore/aggregate.adoc[]
203203
** xref:backup-restore/inspect.adoc[]
204+
** xref:backup-restore/validate.adoc[]
204205
** xref:backup-restore/consistency-checker.adoc[]
205206
** xref:backup-restore/restore-backup.adoc[]
206207
** xref:backup-restore/offline-backup.adoc[]

modules/ROOT/pages/backup-restore/index.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This chapter describes the following:
99
* xref:backup-restore/online-backup.adoc[Back up an online database] -- How to back up an online database.
1010
* xref:backup-restore/aggregate.adoc[Aggregate a database backup chain] - How to aggregate a backup chain into a single backup.
1111
* xref:backup-restore/inspect.adoc[Inspect the metadata of a database backup file] -- How to inspect the metadata of a database backup file.
12+
* xref:backup-restore/validate.adoc[Validate a sharded property database backup] -- How to validate a sharded property database backup using the `neo4j-admin backup validate` command.
1213
* xref:backup-restore/consistency-checker.adoc[Check database consistency] -- How to check the consistency of a database, backup, or a dump.
1314
* xref:backup-restore/restore-backup.adoc[Restore a database backup] -- How to restore a database backup in a live Neo4j deployment.
1415
* xref:backup-restore/offline-backup.adoc[Back up an offline database] -- How to back up an offline database.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
:page-role: new-2025.12 enterprise-edition not-on-aura
2+
[[validate-backup]]
3+
= Validate a sharded property database backup
4+
:description: This section describes how to validate a sharded property database backup using the neo4j-admin backup validate command.
5+
:keywords: neo4j-admin, backup, validate, sharded property databases, sharding
6+
7+
When you back up a sharded property database, you create multiple backup chains—one for each shard.
8+
The backup chains of the graph shard will have 1 full backup and 0 or more differential backups.
9+
Whereas the property shard backup chains will have only 1 full backup, differential backups of property shards are not supported.
10+
See xref:scalability/sharded-property-databases/admin-operations.adoc#backup-and-restore[Backup and restore] for more information on backing up sharded property databases.
11+
12+
To ensure that the backup chains are valid and can be used for restoration, you can use the `neo4j-admin backup validate` command.
13+
14+
[[validate-backup-command]]
15+
== Command
16+
17+
The `neo4j-admin backup validate` command checks the integrity and consistency of the backup artifacts for a specified sharded property database.
18+
19+
[[validate-backup-syntax]]
20+
=== Syntax
21+
22+
[source,role=noheader]
23+
----
24+
neo4j-admin backup validate [-h] [--expand-commands] [--verbose]
25+
[--additional-config=<file>] --database=<database>
26+
[--format=<value>] --from-path=<backup-path>
27+
----
28+
29+
30+
=== Description
31+
32+
Command to validate a collection of backups.
33+
34+
[[validate-backup-command-options]]
35+
=== Options
36+
37+
.`neo4j-admin backup validate` options
38+
[options="header", cols="5m,6a,4m"]
39+
|===
40+
| Option
41+
| Description
42+
| Default
43+
44+
|--additional-config=<file>footnote:[See xref:neo4j-admin-neo4j-cli.adoc#_configuration[Neo4j Admin and Neo4j CLI -> Configuration] for details.]
45+
|Configuration file with additional configuration.
46+
|
47+
48+
|--database=<database>
49+
|Name of the database to validate.
50+
|
51+
52+
| --expand-commands
53+
| Allow command expansion in config value evaluation.
54+
|
55+
56+
|--format=<value>
57+
|Format of the output of the command. Possible values are: 'JSON, TABULAR'.
58+
|TABULAR
59+
60+
|--from-path=<backup-path>
61+
|Path denoting a directory to where backups are stored.
62+
|
63+
64+
|-h, --help
65+
|Show this help message and exit.
66+
|
67+
68+
|--verbose
69+
|Enable verbose output.
70+
|
71+
72+
|===
73+
74+
[[validate-backup-example]]
75+
== Example
76+
77+
To validate a backup for the database `foo` located at _s3://bucket/backups_, use the following command:
78+
79+
[source,shell]
80+
----
81+
bin/neo4j-admin backup validate "foo" --from-path=s3://bucket/backups
82+
----
83+
84+
The output will indicate whether the backups are valid.
85+
For example:
86+
87+
[result]
88+
----
89+
| DATABASE | PATH | STATUS |
90+
| foo-g000 | /bucket/backups/foo-g000-2025-06-11T21-04-42.backup | OK |
91+
| foo-p000 | /bucket/backups/foo-p000-2025-06-11T21-04-37.backup | OK |
92+
| foo-p001 | /bucket/backups/foo-p001-2025-06-11T21-04-40.backup | OK |
93+
----
94+
95+
If valid, the backups can be used to xref:scalability/sharded-property-databases/data-ingestion.adoc#creating-sharded-db-from-uri[seed a sharded property database].
96+
97+
For more examples and details, see xref:scalability/sharded-property-databases/admin-operations.adoc#backup-and-restore[Backup and restore].

modules/ROOT/pages/neo4j-admin-neo4j-cli.adoc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ For details, see xref:backup-restore/restore-backup.adoc[].
174174

175175
For details, see xref:database-administration/standard-databases/upload-to-aura.adoc[].
176176

177-
.2+| `backup`
177+
.3+| `backup`
178178

179179
|`inspect`
180180
| Lists the metadata stored in the header of backup files.
@@ -185,6 +185,11 @@ For details, see xref:backup-restore/inspect.adoc[].
185185
|Aggregates a chain of backup artifacts into a single artifact.
186186

187187
For details, see xref:backup-restore/aggregate.adoc[].
188+
189+
|`validate`
190+
|Validates a collection of sharded property database backups.
191+
192+
For details, see xref:backup-restore/validate.adoc[].
188193
|===
189194

190195
== The `neo4j` tool

modules/ROOT/pages/scalability/sharded-property-databases/admin-operations.adoc

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,34 @@ See xref:scalability/sharded-property-databases/data-ingestion.adoc#splitting-ex
4848
A sharded property database is a database made up of multiple databases.
4949
This means that when you want to back up a database, you must back up all the shards individually, resulting in a sharded property database backup that is composed of multiple smaller backup chains.
5050

51-
Backup chains for each shard are produced using the neo4j-admin database backup.
51+
Backup chains for each shard are produced using the `neo4j-admin database backup` command.
5252
For the graph shard, its backup chain must contain one full artefact and 0+ differential artefacts.
5353
Each property shard’s backup chain must contain only one full backup and no differential backups.
5454
In practical terms, this means that to back up a sharded property database, you start with a full backup of the graph shard and then all of the property shards; any subsequent differential backups would only need to be of the graph shard.
5555
This is because the transaction log of the property shards is the same as the graph shard log and is simply filtered when applied, so only the graph shard log is required for a restore.
5656

57+
=== Validating sharded property database backups
58+
5759
For example, assume there is a sharded property database called `foo` with a graph shard and 2 property shards.
58-
A backup must be taken of each shard, for example:
5960

61+
. Back up each shard, for example:
62+
+
6063
[source,shell]
6164
----
62-
bin/neo4j-admin database backup "foo*" --to-path=/backups --from=localhost:6361 --remote-address-resolution
65+
bin/neo4j-admin backup "foo*" --to-path=/backups --from=localhost:6361 --remote-address-resolution
6366
----
6467

65-
The `--remote-address-resolution` option requires `internal.dbms.cluster.experimental_protocol_version.dbms_enabled=true` to be set in both the _neo4j.conf_ and _neo4j-admin.conf_ files.
66-
67-
You can then check the validity of the resulting backups using:
68-
68+
. Check the validity of the resulting backups.
69+
For details on command syntax and options, see xref:backup-restore/validate.adoc[Validate a database backup].
70+
+
6971
[source,shell]
7072
----
71-
bin/neo4j-admin database backup validate "foo" --from-path=s3://bucket/backups
73+
bin/neo4j-admin backup validate "foo" --from-path=s3://bucket/backups
7274
----
73-
75+
+
7476
The output will indicate whether the backups are valid.
7577
For example:
76-
78+
+
7779
[result]
7880
----
7981
| DATABASE | PATH | STATUS |
@@ -82,21 +84,24 @@ For example:
8284
| foo-p001 | /bucket/backups/foo-p001-2025-06-11T21-04-40.backup | OK |
8385
----
8486

85-
If valid, the backups can be used to seed a sharded property database:
86-
87+
. If valid, the backups can be used to seed a sharded property database:
88+
+
8789
[source,cypher]
8890
----
8991
CYPHER 25 CREATE DATABASE baz SET GRAPH SHARD { TOPOLOGY 3 PRIMARIES 0 SECONDARIES }
9092
SET PROPERTY SHARDS { COUNT 2 TOPOLOGY 1 REPLICA }
9193
OPTIONS {seedUri:"s3://bucket/backups/"};
9294
----
9395

96+
=== Understanding backup validation
97+
9498
Due to potential synchronization issues that might occur when shard backups are not on the exact same transaction IDs (since backups can be taken in parallel or sequentially), the restore process is designed to be very lenient to different shards at different transaction IDs.
9599
As a result, a sharded property database backup is considered valid if the store files of each property shard are within the range of transactions recorded in the graph shard’s transaction log.
96100

97101
For example, assume the graph shard’s store files are at tx 10 and it has transaction logs from tx 11-36, and property shard 1’s store files are at 13 and property shard 2’s store files are at 30, then at restore time, all databases can be recovered and made consistent up to transaction 36.
98102

99103
You can use the command `neo4j-admin backup validate` to check whether a collection of backup chains for a database is valid.
104+
For details on command syntax and options, see xref:backup-restore/validate.adoc[Validate a database backup].
100105

101106
Additional actions may be required to create a validated backup if a property shard is ahead or behind the range of transactions in the graph shard backup chain.
102107

@@ -113,8 +118,8 @@ To form a validated backup, you must ensure that each property shard’s store f
113118
In the example above, property shard `foo-p000` is behind the graph shard backup chain, and property shard `foo-p001` is ahead of the graph shard backup chain.
114119
To form a valid sharded property database backup, you need to:
115120

116-
* Take a full backup of the property shard `foo-p000` so that its store at least includes transaction 5.
117-
* Take a differential backup of the graph shard so that at least transaction 12 is included in its transaction log, so `foo-p001` is included in its range.
121+
. Take a full backup of the property shard `foo-p000` so that its store at least includes transaction 5.
122+
. Take a differential backup of the graph shard, so that at least transaction 12 is included in its transaction log, so `foo-p001` is included in its range.
118123

119124
Once a valid sharded properties database backup is created, differential backups can be performed by taking differential backups of the graph shard, extending the range of the graph shard chain.
120125
Continuing with the example, the graph chain contains transactions from 11 to 36, property shard 1’s store files are at 13, and property shard 2’s store files are at 30.

modules/ROOT/pages/scalability/sharded-property-databases/data-ingestion.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ CYPHER 25 CREATE DATABASE `foo-sharded`
159159
SET PROPERTY SHARDS { COUNT 3 TOPOLOGY 2 REPLICAS };
160160
----
161161

162+
[[creating-sharded-db-from-uri]]
162163
=== Creating a sharded database from a URI
163164

164165
You can create a new sharded property database from an existing database with seeding from one or more URIs.

0 commit comments

Comments
 (0)