Skip to content

Commit 6824c72

Browse files
Add a new guide on deploying multi-region cluster (#2559) (#2590)
Co-authored-by: Nick Giles <[email protected]>
1 parent 2d56f27 commit 6824c72

23 files changed

+630
-109
lines changed

modules/ROOT/content-nav.adoc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@
143143
*** xref:clustering/setup/deploy.adoc[]
144144
*** xref:clustering/setup/analytics-cluster.adoc[]
145145
*** xref:clustering/setup/single-to-cluster.adoc[]
146+
*** xref:clustering/setup/reconciler.adoc[]
146147
*** xref:clustering/setup/discovery.adoc[]
147148
*** xref:clustering/setup/routing.adoc[]
148149
*** xref:clustering/setup/encryption.adoc[]
@@ -153,14 +154,13 @@
153154
*** xref:clustering/monitoring/show-databases-monitoring.adoc[]
154155
*** xref:clustering/monitoring/endpoints.adoc[]
155156
*** xref:clustering/monitoring/status-check.adoc[]
156-
** xref:clustering/disaster-recovery.adoc[]
157+
** Resilient cluster deployment
158+
*** xref:clustering/multi-region-deployment/geo-redundant-deployment.adoc[]
159+
*** xref:clustering/multi-region-deployment/multi-data-center-routing.adoc[]
160+
*** xref:clustering/multi-region-deployment/disaster-recovery.adoc[]
157161
//** xref:clustering/internals.adoc[]
158162
** xref:clustering/settings.adoc[]
159163
** xref:clustering/server-syntax.adoc[]
160-
** xref:clustering/clustering-advanced/index.adoc[]
161-
*** xref:clustering/clustering-advanced/default-database.adoc[]
162-
*** xref:clustering/clustering-advanced/multi-data-center-routing.adoc[]
163-
*** xref:clustering/clustering-advanced/reconciler.adoc[]
164164
** xref:clustering/glossary.adoc[]
165165
166166
* xref:backup-restore/index.adoc[]

modules/ROOT/images/2dc-balanced-membership.svg

Lines changed: 46 additions & 0 deletions
Loading

modules/ROOT/images/2dc-unbalanced-membership.svg

Lines changed: 36 additions & 0 deletions
Loading

modules/ROOT/images/geo-distributed-primaries.svg

Lines changed: 38 additions & 0 deletions
Loading

modules/ROOT/images/geo-distribution-system-db.svg

Lines changed: 112 additions & 0 deletions
Loading

modules/ROOT/images/secondaries-for-read-resilience.svg

Lines changed: 95 additions & 0 deletions
Loading

modules/ROOT/pages/clustering/clustering-advanced/default-database.adoc

Lines changed: 0 additions & 61 deletions
This file was deleted.

modules/ROOT/pages/clustering/clustering-advanced/index.adoc

Lines changed: 0 additions & 15 deletions
This file was deleted.

modules/ROOT/pages/clustering/databases.adoc

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,58 @@ Allowed and denied are mutually exclusive.
364364
If not set, there are no mode constraints on the server.
365365

366366
[[cluster-default-database]]
367-
== Change the default database
367+
== Default database in a cluster
368+
369+
The default database, as defined by xref:configuration/configuration-settings.adoc#config_initial.dbms.default_database[`initial.dbms.default_database`], is automatically created when the DBMS starts for the first time.
370+
This provides a user database to experiment with immediately.
371+
However, this creation is 'best effort' for reasons explained below, and users are encouraged to create their own default database for production use.
372+
If you create your own default database, even if you just run `DROP DATABASE neo4j` and `CREATE DATABASE neo4j`, you do not have to be aware of the complexities below.
373+
374+
[[default-database-automatic-creation]]
375+
=== Automatic default database creation
376+
377+
The initial default database is created when the DBMS starts for the first time.
378+
It uses the following settings:
379+
380+
* xref:configuration/configuration-settings.adoc#config_initial.dbms.default_database[`initial.dbms.default_database`] -- the name of the database.
381+
* xref:configuration/configuration-settings.adoc#config_initial.dbms.default_primaries_count[`initial.dbms.default_primaries_count`] -- the number of primaries requested for the default database.
382+
* xref:configuration/configuration-settings.adoc#config_initial.dbms.default_secondaries_count[`initial.dbms.default_secondaries_count`] -- the number of secondaries requested for the default database.
383+
384+
However, it uses the default primary and secondary counts (topology) as maximums, not as hard requirements.
385+
This is different to normal database creation, where if the requested topology cannot be satisfied, creation fails.
386+
For the automatic creation of the default database alone, if the requested topology cannot be satisfied, you get as many of each hosting type as can be satisfied by the current cluster.
387+
This means you may end up with a default database with as few as one primary and no secondaries, despite the default values being higher.
388+
It is also possible to configure a cluster where automatic creation of the default database is not possible when the DBMS starts up.
389+
In this case, creation fails, a warning is logged, and creation *is not be re-attempted*.
390+
391+
Automatic creation of the initial default database works as follows:
392+
393+
* As the cluster starts for the first time, there is a configured threshold for how many servers are required to create the DBMS - `dbms.cluster.minimum_initial_system_primaries_count`.
394+
* Once *a minimum* of this many servers have discovered each other, the `system` database bootstraps, allowing creation of the DBMS.
395+
* The initial default database is created with those servers as the possible hosts.
396+
* If any of the servers block hosting the default database (see xref:configuration/configuration-settings.adoc#config_initial.server.denied_databases[`initial.server.denied_databases`]), they are not used.
397+
* If any of the servers restrict the mode they can host a database in, that is obeyed (see xref:configuration/configuration-settings.adoc#config_initial.server.mode_constraint[`initial.server.mode_constraint`]).
398+
* If there are too few servers to allocate the requested number of primaries, whichever ones available are used.
399+
If there are zero available primaries, automatic creation fails.
400+
* If there are too few servers remaining after the primary allocation to satisfy the requested number of secondaries, whicever ones available are used.
401+
402+
Some possible behaviours that may be observed as a result of the above approach:
403+
404+
* If `initial.dbms.default_primaries_count` is larger than `dbms.cluster.minimum_initial_system_primaries_count`, you are likely to get an initial default database with fewer primaries than the default.
405+
This is because DBMS initialisation only waits for the minimum system primaries.
406+
* If `initial.dbms.default_secondaries_count` plus `initial.dbms.default_primaries_count` is larger than `dbms.cluster.minimum_initial_system_primaries_count`, you are likely to get an initial default database with fewer secondaries than the default.
407+
This is because DBMS initialisation only waits for the minimum number of system primaries.
408+
* If you use `initial.server.denied_databases` to prevent the allocation of your default database to any of your initial servers, you may end up with fewer copies of the database than the default request, and possibly even no default database.
409+
* If you use `initial.server.mode_constraint=SECONDARY` for any of your initial servers, you may end up with fewer primary copies of the database than the default request, and possibly even no default database.
410+
411+
[[default-database-change-topology]]
412+
=== Changing default database topology
413+
414+
If the default database is initially created for you with a topology different to what you want, you can update it in the same way as any database, see <<alter-topology, Alter topology>>.
415+
416+
417+
[[change-default-database]]
418+
=== Change the default database
368419

369420
You can use the procedure xref:procedures.adoc#procedure_dbms_setDefaultDatabase[`dbms.setDefaultDatabase("newDefaultDatabaseName")`] to change the default database for a DBMS.
370421

@@ -374,11 +425,6 @@ You can use the procedure xref:procedures.adoc#procedure_dbms_setDefaultDatabase
374425
. Run `CALL dbms.setDefaultDatabase("newDefaultDatabaseName")` against the `system` database to set the new default database.
375426
. Optionally, you can start the previous default database as non-default by using `START DATABASE <database-name>`.
376427

377-
[NOTE]
378-
====
379-
Be aware that the automatically created _initial_ default database may have a different topology to the default configuration values.
380-
See xref:clustering/clustering-advanced/default-database.adoc[Default database in a cluster] for more information.
381-
====
382428

383429
[[cluster-database-error-handling]]
384430
== Handling errors
@@ -387,4 +433,4 @@ Databases can get into error states.
387433
Typically you can observe this with the `SHOW DATABASES` command, and use the xref:database-administration/standard-databases/errors.adoc[error handling guidance] to help.
388434

389435
In more serious cases you may be dealing with a disaster situation, where the whole DBMS may not be responding correctly, or some specific databases cannot be restored without downtime.
390-
Refer to the xref:clustering/disaster-recovery.adoc[disaster recovery guide] for those situations.
436+
Refer to the xref:clustering/multi-region-deployment/disaster-recovery.adoc[disaster recovery guide] for those situations.

modules/ROOT/pages/clustering/index.adoc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ This chapter describes the following:
1010
** xref:clustering/setup/deploy.adoc[Deploy a basic cluster] -- How to set up a basic cluster.
1111
** xref:clustering/setup/analytics-cluster.adoc[Deploy an analytics cluster] -- How to deploy a special case Neo4j cluster for analytic queries.
1212
** xref:clustering/setup/single-to-cluster.adoc[Move from a standalone deployment to a cluster] -- This section describes how to move from a single Neo4j server to Neo4j cluster.
13+
** xref:clustering/setup/reconciler.adoc[Reconciler] -- An internal component that observes the requested state of a server and makes changes to the server to match that state.
1314
** xref:clustering/setup/discovery.adoc[Cluster server discovery] -- How servers in a cluster discover each other and form a cluster.
1415
** xref:clustering/setup/routing.adoc[Leadership, routing and load balancing] -- Election of leaders, routing and load balancing.
1516
** xref:clustering/setup/encryption.adoc[Intra-cluster encryption] -- How to secure the cluster communication.
16-
* xref:clustering/servers.adoc[Managing servers in a cluster] -- How to manage manage the servers in a cluster.
17+
* xref:clustering/servers.adoc[Managing servers in a cluster] -- How to manage the servers in a cluster.
1718
* xref:clustering/databases.adoc[Managing databases in a cluster] -- How to manage the databases in a cluster.
1819
* Monitoring -- Monitoring of a cluster.
1920
** xref:clustering/monitoring/show-servers-monitoring.adoc[Monitor servers] -- The tools available for monitoring the servers in a cluster.
2021
** xref:clustering/monitoring/show-databases-monitoring.adoc[Monitor databases] -- The tools available for monitoring the databases in a cluster.
2122
** xref:clustering/monitoring/endpoints.adoc[Monitor cluster endpoints for status information] -- The endpoints and semantics of endpoints used to monitor the health of the cluster.
2223
** xref:clustering/monitoring/status-check.adoc[Monitor replication status] label:new[Introduced in 5.24] -- The procedure to monitor which members of a clustered database are up-to-date and can participate in a successful replication.
23-
* xref:clustering/disaster-recovery.adoc[Disaster recovery] -- How to recover a cluster in the event of a disaster.
24+
* Resilient cluster deployment -- Recommendations and guidance on how to set up a resilient cluster which ensures your database stays available, fast, and recoverable even under failures.
25+
** xref:clustering/multi-region-deployment/geo-redundant-deployment.adoc[] -- Recommended patterns of cluster deployment across multiple cloud regions / data centers.
26+
** xref:clustering/multi-region-deployment/multi-data-center-routing.adoc[Multi-data center routing] -- Clusters on multi-data centers.
27+
** xref:clustering/multi-region-deployment/disaster-recovery.adoc[Disaster recovery] -- How to recover a cluster in the event of a disaster.
2428
* xref:clustering/settings.adoc[Settings reference] -- A summary of the most important cluster settings.
2529
* xref:clustering/server-syntax.adoc[Server commands reference] -- Reference of Cypher administrative commands to add and manage servers.
26-
* xref:clustering/clustering-advanced/index.adoc[Advanced clustering] -- Some more advanced features of Neo4j clusters.
27-
** xref:clustering/clustering-advanced/default-database.adoc[Default database in a cluster] -- The initial default database created when the DBMS starts for the first time.
28-
** xref:clustering/clustering-advanced/multi-data-center-routing.adoc[Multi-data center routing] -- Clusters on mutli-data centers.
29-
** xref:clustering/clustering-advanced/reconciler.adoc[Reconciler] -- An internal component that observes the requested state of a server and makes changes to the server to match that state.
3030
* xref:clustering/glossary.adoc[Clustering glossary] -- A glossary of terms related to the Neo4j clustering.
3131
3232

0 commit comments

Comments
 (0)