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
Copy file name to clipboardExpand all lines: modules/ROOT/pages/clustering/databases.adoc
+15-14Lines changed: 15 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,16 +4,17 @@
4
4
[[database-management]]
5
5
= Managing databases in a cluster
6
6
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, 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.
9
10
If a database is no longer needed, the command `DROP DATABASE` deletes the database from the cluster.
10
11
11
12
[[create-database]]
12
13
== `CREATE DATABASE`
13
14
14
15
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
16
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:
17
18
18
19
[source, cypher]
19
20
----
@@ -45,7 +46,7 @@ For example, if the cluster's servers are set up with mode constraints to contai
45
46
[NOTE]
46
47
====
47
48
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_.
48
-
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.
49
50
====
50
51
51
52
[NOTE]
@@ -64,7 +65,7 @@ To alter the topology of or read/write access to a database after it has been cr
64
65
[[alter-topology]]
65
66
=== Alter database topology
66
67
67
-
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:
68
69
69
70
[source, cypher]
70
71
----
@@ -98,19 +99,19 @@ Note, like `CREATE DATABASE`, the `ALTER DATABASE` command allocates the databas
98
99
99
100
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.
100
101
101
-
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.
102
104
103
-
However, it is possible to _manually_ do this transition.
104
-
The first step is to back up the database, see xref:backup-restore/index.adoc[Backup and restore] for more information.
105
-
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.
106
-
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.
107
111
See xref:clustering/databases.adoc#cluster-seed[Seed a cluster] further on for information on seeding.
108
112
109
113
Also, it is possible to automatically transition _from_ a topology with a single primary host to multiple primary hosts.
110
-
Keep in mind that during such a transition, the database will be unavailable for a short period of time.
111
-
112
-
`ALTER DATABASE` commands are optionally idempotent, with the default behavior to fail with an error if the database does not exist.
113
-
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.
114
115
115
116
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.
0 commit comments