You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Move the recreate procedure to the separate page in 5.x (#2417)
The recreate procedure in the 5.x version can also be applied to a
standalone database. Therefore, we need to move it to a separate page
under the _Database administration_ section, as it has already been done
in the current docs (see the `main` branch). See PR #2367.
@@ -13,7 +13,7 @@ If a database is no longer needed, the command `DROP DATABASE` deletes the datab
13
13
14
14
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).
15
15
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:
16
+
To create a database `foo` with 3 servers hosting the database in primary mode and 2 servers in secondary mode, run the following command:
17
17
18
18
[source, cypher]
19
19
----
@@ -44,11 +44,12 @@ For example, if the cluster's servers are set up with mode constraints to contai
44
44
[NOTE]
45
45
====
46
46
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.
47
+
After cluster startup, you can overwrite these values using the `dbms.setDefaultAllocationNumbers` procedure.
48
48
====
49
+
49
50
[NOTE]
50
51
====
51
-
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]).
52
+
The `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]).
52
53
However, over time, or after several `CREATE DATABASE` commands have been issued, the distribution of databases can become unbalanced.
53
54
At this point you can run `REALLOCATE DATABASES` to make the cluster re-balance databases across all servers that are part of the cluster.
54
55
====
@@ -61,12 +62,13 @@ To alter the topology of or read/write access to a database after it has been cr
61
62
[[alter-topology]]
62
63
=== Alter database topology
63
64
64
-
To change the topology of the database `foo` from the previous example, the command can look like this:
65
+
To change the topology of the database `foo` from the previous example, run the following command:
65
66
66
67
[source, cypher]
67
68
----
68
69
ALTER DATABASE foo SET TOPOLOGY 2 PRIMARIES 1 SECONDARY
69
70
----
71
+
70
72
Alternatively, starting from 5.26, you can use link:{neo4j-docs-base-uri}/cypher-manual/{page-version}/syntax/parameters[parameters] to provide the number of primaries and secondaries:
71
73
72
74
.Parameters
@@ -97,18 +99,18 @@ This normally happens when the cluster is configured with more servers than the
97
99
98
100
It is not possible to automatically transition to a topology with a single primary host. Attempting to do so results in an error.
99
101
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.
102
+
However, it is possible to _manually_ do this transition:
103
+
104
+
. First, back up the database.
105
+
See xref:backup-restore/index.adoc[Backup and restore] for more information.
106
+
. Once the database is backed up, drop the database.
107
+
See xref:database-administration/standard-databases/delete-databases.adoc[Delete databases] for more information.
108
+
. 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.
104
109
See xref:clustering/databases.adoc#cluster-seed[Seed a cluster] further on for information on seeding.
105
110
106
111
Also, it is possible to automatically transition _from_ a topology with a single primary host to multiple primary hosts.
107
112
Keep in mind that during such a transition, the database will be unavailable for a short period of time.
108
113
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.
111
-
112
114
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.
Neo4j 5.24 introduces the xref:procedures.adoc#procedure_dbms_cluster_recreateDatabase[`dbms.cluster.recreateDatabase()`] procedure, which allows you:
267
-
268
-
* To change the database store to a specified backup, while keeping all the associated privileges for the database.
269
-
270
-
* To make your database write-available again after it has been lost (for example, due to a disaster).
271
-
See xref:clustering/disaster-recovery.adoc[Disaster recovery] for more information.
272
-
273
-
[CAUTION]
274
-
====
275
-
The recreate procedure works only for real user databases and not for composite databases, or the `system` database.
276
-
277
-
Remember that the recreate procedure results in downtime while the stores get updated.
278
-
The time is unbounded and may depend on different factors -- for example, the size of the store, network speed, etc.
279
-
====
280
-
281
-
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.
282
-
283
-
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.
284
-
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].
285
-
286
-
Before recreating a database, any eventual quarantined states need to be addressed.
287
-
For more information, see xref:database-administration/standard-databases/errors.adoc#quarantine[Standard databases -> Error handling].
288
-
289
-
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.
290
-
291
-
To check if the recreation is successful, use the `SHOW DATABASES` command and verify that all allocations have been started.
292
-
293
-
Additionally, you have the option to modify <<alter-topology-recreate, the topology>> during the recreation process.
294
-
However, note that the store format, access, and enrichment cannot be altered during recreation.
295
-
296
-
[[recreate-seeding-options]]
297
-
=== Seeding options
298
-
299
-
The store to be used during the recreation of a database can be defined in different ways.
300
-
One method uses a backup, while others use available allocations in the cluster.
301
-
302
-
You can use either <<uri-seed, `seedURI`>> or <<seed-servers, `seedingServers`>> to specify the source from which the database should be recreated.
303
-
304
-
* If you define neither, an error is thrown.
305
-
306
-
* If you define both of them, then `seedingServers` must be an empty list.
307
-
See <<undefined-servers-backup, Undefined servers with fallback backup>> for more details.
308
-
309
-
* If `seedingServers` is not empty and `seedURI` is also defined, an error will occur.
310
-
311
-
[[uri-seed]]
312
-
==== Use backup as a seed
313
-
314
-
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.
315
-
The new allocations can be put on any `ENABLED` server in the cluster.
316
-
See xref::database-administration/standard-databases/seed-from-uri.adoc[Seed from URI] for more details.
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.
352
-
The store will be replaced by the most up-to-date seeder available in the cluster.
There is an option to define a new topology when recreating a database.
375
-
This can be beneficial during a disaster, if enough servers are not available to recreate the database with the original topology.
376
-
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.
377
-
This also holds true when using recreate with an empty list of seeders.
378
-
If there are more available servers in the cluster hosting the database than the number of new allocations, the recreation will fail.
Copy file name to clipboardExpand all lines: modules/ROOT/pages/clustering/disaster-recovery.adoc
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -220,14 +220,14 @@ Instead, check that the primary is allocated on an available server and that it
220
220
=====
221
221
222
222
. For each database that is not write-available, recreate it to move it from lost servers and regain write availability.
223
-
Go to xref:clustering/databases.adoc#recreate-databases[Recreate databases] for more information about recreate options.
223
+
Go to xref:database-administration/standard-databases/recreate-database.adoc[Recreate a database] for more information about recreate options.
224
224
Remember to make sure there are recent backups for the databases before recreating them.
225
225
See xref:backup-restore/online-backup.adoc[Online backup] for more information.
226
-
If any database has `currentStatus` = `quarantined` on an available server, recreate them from backup using xref:clustering/databases.adoc#uri-seed[Backup as seed].
226
+
If any database has `currentStatus` = `quarantined` on an available server, recreate them from backup using xref:database-administration/standard-databases/recreate-database.adoc#uri-seed[Backup as seed].
227
227
+
228
228
[CAUTION]
229
229
=====
230
-
If you recreate databases using xref:clustering/databases.adoc#undefined-servers[undefined servers] or xref:clustering/databases.adoc#undefined-servers-backup[undefined servers with fallback backup], the store might not be recreated as up-to-date as possible in certain edge cases where the `system` database has been restored.
230
+
If you recreate databases using xref:database-administration/standard-databases/recreate-database.adoc#undefined-servers[undefined servers] or xref:database-administration/standard-databases/recreate-database.adoc#undefined-servers-backup[undefined servers with fallback backup], the store might not be recreated as up-to-date as possible in certain edge cases where the `system` database has been restored.
231
231
=====
232
232
233
233
. For each `Cordoned` server, run `DEALLOCATE DATABASES FROM SERVER cordoned-server-id` on one of the available servers.
@@ -258,7 +258,7 @@ If they are still desired to be in stopped state, run `STOP DATABASE started-db
258
258
259
259
[CAUTION]
260
260
====
261
-
Remember, recreating a database takes an unbounded amount of time since it may involve copying the store to a new server, as described in xref:clustering/databases.adoc#recreate-databases[Recreate databases].
261
+
Remember, recreating a database takes an unbounded amount of time since it may involve copying the store to a new server, as described in xref:database-administration/standard-databases/recreate-database.adoc[Recreate a database].
262
262
Therefore, an allocation with `currentStatus` = `starting` will probably reach the `requestedStatus` given some time.
263
263
====
264
264
@@ -291,21 +291,21 @@ Recreations might fail for different reasons, but one example is that the checks
291
291
. Identify all write-unavailable databases by running `CALL dbms.cluster.statusCheck([])` as described in the xref:clustering/disaster-recovery.adoc#example-verification[Example verification] part of this disaster recovery step.
292
292
Filter out all databases desired to be stopped, so that they are not recreated unnecessarily.
293
293
. Recreate every database that is not write-available and has not been recreated previously.
294
-
See xref:clustering/databases.adoc#recreate-databases[Recreate databases] for more information.
294
+
See xref:database-administration/standard-databases/recreate-database.adoc[Recreate a database] for more information.
295
295
Remember to make sure there are recent backups for the databases before recreating them.
296
296
See xref:backup-restore/online-backup.adoc[Online backup] for more information.
297
-
If any database has `currentStatus` = `quarantined` on an available server, recreate them from backup using xref:clustering/databases.adoc#uri-seed[Backup as seed].
297
+
If any database has `currentStatus` = `quarantined` on an available server, recreate them from backup using xref:database-administration/standard-databases/recreate-database.adoc#uri-seed[Backup as a seed].
298
298
+
299
299
[CAUTION]
300
300
=====
301
-
If you recreate databases using xref:clustering/databases.adoc#undefined-servers[undefined servers] or xref:clustering/databases.adoc#undefined-servers-backup[undefined servers with fallback backup], the store might not be recreated as up-to-date as possible in certain edge cases where the `system` database has been restored.
301
+
If you recreate databases using xref:database-administration/standard-databases/recreate-database.adoc#undefined-servers[undefined servers] or xref:database-administration/standard-databases/recreate-database.adoc#undefined-servers-backup[undefined servers with fallback backup], the store might not be recreated as up-to-date as possible in certain edge cases where the `system` database has been restored.
302
302
=====
303
303
304
304
. Run `SHOW DATABASES` and check any recreated databases that are not write-available.
305
305
Recreating a database will not complete if one of the following messages is displayed in the message field:
306
306
** `Seeders ServerId1 and ServerId2 have different checksums for transaction TransactionId. All seeders must have the same checksum for the same append index.`
307
307
** `Seeders ServerId1 and ServerId2 have incompatible storeIds. All seeders must have compatible storeIds.`
308
308
** `No store found on any of the seeders ServerId1, ServerId2...`
309
-
. For each database which will not complete recreation, recreate them from backup using xref:clustering/databases.adoc#uri-seed[Backup as seed].
309
+
. For each database which will not complete recreation, recreate them from backup using xref:database-administration/standard-databases/recreate-database.adoc#uri-seed[Backup as a seed].
0 commit comments