Skip to content

Commit 89fa85d

Browse files
Merge branch 'cypher-25' into cypher25-default-language
2 parents a3736b1 + 4402ea0 commit 89fa85d

File tree

12 files changed

+362
-295
lines changed

12 files changed

+362
-295
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@
118118
*** xref:database-administration/standard-databases/listing-databases.adoc[]
119119
*** xref:database-administration/standard-databases/alter-databases.adoc[]
120120
*** xref:database-administration/standard-databases/start-stop-databases.adoc[]
121+
*** xref:database-administration/standard-databases/recreate-database.adoc[]
121122
*** xref:database-administration/standard-databases/delete-databases.adoc[]
122123
*** xref:database-administration/standard-databases/migrate-database.adoc[]
123124
*** xref:database-administration/standard-databases/upload-to-aura.adoc[]

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,15 +175,14 @@ That means, if you restore `neo4j-2023-06-29T14-50-45.backup`, your database wil
175175
=== Restore a database backup
176176

177177
The following examples assume that you want to restore your data in a new database, called `mydatabase`.
178-
If you want to replace an existing database, you need to stop it first, and add the option `--overwrite-destination=true` to the restore command.
179-
180-
==== Restore a full backup
178+
If you want to replace an existing database, you need to stop it first and add the option `--overwrite-destination=true` to the restore command.
181179

180+
+
182181
. Restore a database backup by running the following command:
183182
+
184183
[source, shell,role=nocopy noplay]
185184
----
186-
bin/neo4j-admin database restore --from-path=/path/to/backups/neo4j-2023-05-05T11-26-38.backup mydatabase
185+
bin/neo4j-admin database restore --from-path=/path/to/backups/neo4j-2023-06-29T14-51-33.backup mydatabase
187186
----
188187
+
189188
The `--from-path=` argument must contain the path to the last backup of a chain, in this case, `neo4j-2023-06-29T14-51-33.backup`.
@@ -200,9 +199,11 @@ You should also skip the `CREATE DATABASE` step afterward if you are replacing a
200199
CREATE DATABASE mydatabase
201200
----
202201

202+
203203
=== Restore data up to a specific date
204204

205205
To restore data up to a specific date, you need to pass the backup artifact that contains the data up to that date. +
206+
206207
This example assumes that you want to restore your data in a new database, called `mydatabase`.
207208
If you want to replace an existing database, you need to stop it first, and add the option `--overwrite-destination=true` to the restore command.
208209

modules/ROOT/pages/changes-deprecations-removals.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ Replaced by xref:backup-restore/aggregate.adoc[`neo4j-admin backup aggregate`]
556556

557557
`S3SeedProvider` is deprecated since Neo4j 5.26 and replaced by the `CloudSeedProvider`.
558558

559-
For more information, see xref:clustering/databases.adoc#s3-seed-provider[Seed from URI].
559+
For more information, see xref:database-administration/standard-databases/seed-from-uri.adoc#s3-seed-provider[Seed from URI].
560560

561561

562562
=== Java API

modules/ROOT/pages/clustering/databases.adoc

Lines changed: 18 additions & 174 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,23 @@
44
[[database-management]]
55
= Managing databases in a cluster
66

7-
The number of both primary and secondary servers to host a database can be set when the database is created and altered after creation.
8-
The command `CREATE DATABASE` can be used to specify the initial topology and `ALTER DATABASE` can be used to change the topology once the database is created.
7+
When creating a database or altering it after creation, you can set the number of both primary and secondary servers to host your database.
8+
To specify the initial topology, use the command `CREATE DATABASE`.
9+
To change the topology once the database is created, run the `ALTER DATABASE` command.
910
If a database is no longer needed, the command `DROP DATABASE` deletes the database from the cluster.
1011

1112
[[create-database]]
1213
== `CREATE DATABASE`
1314

1415
The command to create a database in a cluster is not significantly different from the command to create a database in a non-clustered environment (see xref:database-administration/standard-databases/create-databases.adoc[Create, start, and stop databases] for more information on database management on single servers).
1516
The difference in a clustered environment is that the topology can be specified, i.e. how many primaries and secondaries are desired for the database.
16-
To create a database `foo` with 3 servers hosting the database in primary mode and 2 servers in secondary mode, the command looks like this:
17+
To create a database `foo` with 3 servers hosting the database in primary mode and 2 servers in secondary mode, run the following command:
1718

1819
[source, cypher]
1920
----
2021
CREATE DATABASE foo TOPOLOGY 3 PRIMARIES 2 SECONDARIES
2122
----
23+
2224
Alternatively, you can use link:{neo4j-docs-base-uri}/cypher-manual/current/syntax/parameters[parameters] to provide the number of primaries and secondaries:
2325

2426
.Parameters
@@ -44,11 +46,13 @@ For example, if the cluster's servers are set up with mode constraints to contai
4446
[NOTE]
4547
====
4648
If `TOPOLOGY` is not specified, the database is created according to `initial.dbms.default_primaries_count` and `initial.dbms.default_secondaries_count` specified in _neo4j.conf_.
47-
After cluster startup, these values can be overwritten using the `dbms.setDefaultAllocationNumbers` procedure.
49+
After cluster startup, you can overwrite these values using the `dbms.setDefaultAllocationNumbers` procedure.
4850
====
51+
4952
[NOTE]
5053
====
5154
A `CREATE DATABASE` command allocates the database, therefore there is no requirement to execute `REALLOCATE DATABASES` (described in xref:clustering/servers.adoc#_hosting_databases_on_added_servers[Hosting databases on added servers]).
55+
5256
However, over time, or after several `CREATE DATABASE` commands have been issued, the distribution of databases can become unbalanced.
5357
At this point you can run `REALLOCATE DATABASES` to make the cluster re-balance databases across all servers that are part of the cluster.
5458
====
@@ -61,7 +65,7 @@ To alter the topology of or read/write access to a database after it has been cr
6165
[[alter-topology]]
6266
=== Alter database topology
6367

64-
To change the topology of the database `foo` from the previous example, the command can look like this:
68+
To change the topology of the database `foo` from the previous example, run the following command:
6569

6670
[source, cypher]
6771
----
@@ -95,19 +99,19 @@ Note, like `CREATE DATABASE`, the `ALTER DATABASE` command allocates the databas
9599

96100
This normally happens when the cluster is configured with more servers than the sum of the number of primaries and secondaries for any one database.
97101

98-
It is not possible to automatically transition to a topology with a single primary host. Attempting to do so results in an error.
102+
It is not possible to automatically transition to a topology with a single primary host.
103+
Attempting to do so results in an error.
99104

100-
However, it is possible to _manually_ do this transition.
101-
The first step is to back up the database, see xref:backup-restore/index.adoc[Backup and restore] for more information.
102-
Once the database is backed up, the next step is to drop the database, see xref:database-administration/standard-databases/delete-databases.adoc[Delete databases] for more information.
103-
The last step is to either seed a cluster from the backup with the new topology, or to restore the backup on a single server.
105+
However, it is possible to _manually_ do this transition:
106+
107+
. The first step is to back up the database, see xref:backup-restore/index.adoc[Backup and restore] for more information.
108+
. Once the database is backed up, the next step is to drop the database.
109+
See xref:database-administration/standard-databases/delete-databases.adoc[Delete databases] for more details.
110+
. The last step is to either seed a cluster from the backup with the new topology, or to restore the backup on a single server.
104111
See xref:clustering/databases.adoc#cluster-seed[Seed a cluster] further on for information on seeding.
105112

106113
Also, it is possible to automatically transition _from_ a topology with a single primary host to multiple primary hosts.
107-
Keep in mind that during such a transition, the database will be unavailable for a short period of time.
108-
109-
`ALTER DATABASE` commands are optionally idempotent, with the default behavior to fail with an error if the database does not exist.
110-
Appending `IF EXISTS` to the command ensures that no error is returned and nothing happens should the database not exist.
114+
Keep in mind that during such a transition, the database is unavailable for a short period of time.
111115

112116
If the `ALTER DATABASE` command decreases the number of allocations of a database, allocations on xref:clustering/servers.adoc#cordoned-state[cordoned servers] are removed first.
113117

@@ -246,166 +250,6 @@ neo4j@neo4j> DRYRUN REALLOCATE DATABASES;
246250
----
247251

248252

249-
[[recreate-databases]]
250-
== Recreate a database
251-
252-
In Neo4j 2025.04, the xref:procedures.adoc#procedure_dbms_cluster_recreateDatabase[`dbms.cluster.recreateDatabase()`] procedure is deprecated in favour of xref:procedures.adoc#procedure_dbms_recreateDatabase[`dbms.recreateDatabase()`].
253-
254-
The recreate procedure allows you to:
255-
256-
* Change the database store to a specified backup, while keeping all the associated privileges for the database.
257-
258-
* Make your database write-available again after it has been lost (for example, due to a disaster).
259-
See xref:clustering/disaster-recovery.adoc[Disaster recovery] for more information.
260-
261-
* label:new[Introduced in 2025.02] Delete the data and schema for a database, while keeping the database privileges assigned to each role.
262-
263-
* label:new[Introduced in 2025.04] Alter the database store format when clearing the data and schema.
264-
265-
[CAUTION]
266-
====
267-
The recreate procedure works only for real user databases and not for composite databases, or the `system` database.
268-
269-
Remember that the recreate procedure results in downtime while the stores get updated.
270-
The time is unbounded and may depend on different factors -- for example, the size of the store, network speed, etc.
271-
====
272-
273-
The database in question can be in an `online` or `offline` state when it is recreated, but a successful operation starts the database regardless of its previous state.
274-
275-
If your database has Change Data Capture (CDC) enabled, the CDC chain will stop when the database is recreated, even though CDC remains enabled in the recreated database.
276-
To restore CDC functionality, follow the guide on how link:https://neo4j.com/docs/cdc/current/existing-databases/[to initialize CDC applications from an existing database].
277-
278-
Before recreating a database, any eventual quarantined states need to be addressed.
279-
For more information, see xref:database-administration/standard-databases/errors.adoc#quarantine[Standard databases -> Error handling].
280-
281-
You need xref:authentication-authorization/dbms-administration.adoc#access-control-dbms-administration-database-management[the `CREATE DATABASE` and `DROP DATABASE` privileges] to run the recreate procedure.
282-
283-
To check if the recreation is successful, use the `SHOW DATABASES` command and verify that all allocations have been started.
284-
285-
Additionally, you have the option to modify <<alter-topology-recreate, the topology>> during the recreation process.
286-
However, note that up to Neo4j 2025.04, the store format, access, and enrichment cannot be altered during recreation.
287-
Starting with 2025.04, the store format can only be altered if the `clearData` option is used.
288-
289-
[[recreate-seeding-options]]
290-
=== Seeding options
291-
292-
The store to be used during the recreation of a database can be defined in different ways.
293-
One method uses a backup, while others use available allocations in the cluster.
294-
295-
You can use either <<uri-seed, `seedURI`>> or <<seed-servers, `seedingServers`>> to specify the source from which the database should be recreated.
296-
297-
* If you define neither, an error is thrown.
298-
299-
* If you define both of them, then `seedingServers` must be an empty list.
300-
See <<undefined-servers-backup, Undefined servers with fallback backup>> for more details.
301-
302-
* If `seedingServers` is not empty and `seedURI` is also defined, an error will occur.
303-
304-
[[uri-seed]]
305-
==== Use backup as a seed
306-
307-
If you provide a URI to a backup or a dump, the stores on all allocations will be replaced by the backup or the dump at the given URI.
308-
The new allocations can be put on any `ENABLED` server in the cluster.
309-
See xref::database-administration/standard-databases/seed-from-uri.adoc[Seed from URI] for more details.
310-
311-
312-
[source, shell]
313-
----
314-
CALL dbms.recreateDatabase("neo4j", {seedURI: "s3://myBucket/myBackup.backup"});
315-
----
316-
317-
[[seed-servers]]
318-
==== Use available servers as a seed
319-
320-
After the recreation is complete, the database will have the latest data store from the seeding servers.
321-
322-
[CAUTION]
323-
====
324-
Recreation is based on remaining stores or a store defined by the user.
325-
This means that stores which were lost or not defined are not used for the recreation.
326-
If not used stores were more up to date than the used ones, this results in data loss.
327-
====
328-
329-
[[specified-servers]]
330-
Specified servers::
331-
332-
You can specify a set of available servers.
333-
The stores on all allocations will be synchronized to the most up-to-date store from the defined servers.
334-
The number of defined servers cannot exceed the number of total allocations in the desired topology.
335-
+
336-
[source, shell]
337-
----
338-
CALL dbms.recreateDatabase("neo4j", {seedingServers: ["serverId1", "serverId2", "serverId3"]});
339-
----
340-
341-
[[undefined-servers]]
342-
Undefined servers::
343-
344-
If you provide an empty list of seeding servers and do not specify a `seedURI`, Neo4j automatically selects all available allocations of the database as seeders.
345-
The store will be replaced by the most up-to-date seeder available in the cluster.
346-
+
347-
[source, shell]
348-
----
349-
CALL dbms.recreateDatabase("neo4j", {seedingServers: []});
350-
----
351-
352-
[[undefined-servers-backup]]
353-
Undefined servers with fallback backup::
354-
355-
If both an empty list of seeding servers and a `seedURI` are provided, Neo4j finds all available allocations of the database and use those as seeders.
356-
However, if no available servers can be found, the database is recreated based on the backup or the dump defined by the URI.
357-
This means the store is replaced by the most up-to-date seeder if available; otherwise, the backup is used.
358-
+
359-
[source, shell]
360-
----
361-
CALL dbms.recreateDatabase("neo4j", {seedingServers: [], seedURI: "s3://myBucket/myBackup.backup"});
362-
----
363-
364-
365-
[[alter-topology-recreate]]
366-
=== Change the topology
367-
368-
There is an option to define a new topology when recreating a database.
369-
This can be beneficial during a disaster, if enough servers are not available to recreate the database with the original topology.
370-
When altering the total number of allocations down during a recreation, it is important to remember that the number of seeding servers cannot exceed the number of total allocations of the database.
371-
This also holds true when using recreate with an empty list of seeders.
372-
If there are more available servers in the cluster hosting the database than the number of new allocations, the recreation will fail.
373-
374-
[source, shell]
375-
----
376-
CALL dbms.recreateDatabase("neo4j", {seedingServers: [], primaries: 3, secondaries: 0});
377-
----
378-
379-
380-
[role=label--new-2025.02]
381-
[[clear-data-recreate]]
382-
=== Clear data option
383-
384-
In Neo4j 2025.02, the `clearData` option was added to the recreate procedure.
385-
This option allows you to delete the data (e.g., nodes and relationships) and the schema (e.g., constraints and indexes) for the database.
386-
This means you end up with an empty store, but as with the other recreate database options, all privileges associated with the database are kept.
387-
388-
[CAUTION]
389-
====
390-
Using the clear data option means the data and schema will be deleted *permanently*.
391-
If you want to have the option of getting them back later, make sure to take a backup before clearing the database.
392-
See xref:backup-restore/online-backup.adoc[Online backup] for more information.
393-
====
394-
395-
[role=label--new-2025.04]
396-
[[alter-store-format]]
397-
==== Alter the database store format
398-
399-
In Neo4j 2025.04, the database store format can also be altered during recreation, but only when the `clearData` option is specified.
400-
401-
See xref:database-internals/store-formats.adoc[Store formats], for more details about available database store formats in Neo4j.
402-
If the store format option is not defined, the recreated database ends up with the same store format as before the recreation.
403-
404-
[source, shell]
405-
----
406-
CALL dbms.recreateDatabase("neo4j", {clearData: true, storeFormat: "block"});
407-
----
408-
409253

410254
[[cluster-seed]]
411255
== Seed a cluster

0 commit comments

Comments
 (0)