Skip to content

Commit 830d8f5

Browse files
committed
add the files
1 parent 79abde5 commit 830d8f5

File tree

12 files changed

+4021
-0
lines changed

12 files changed

+4021
-0
lines changed
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
:description: Describes the Neo4j consistency checker.
2+
[[consistency-checker]]
3+
= Check database consistency
4+
5+
You can use the `neo4j-admin database check` command to check the consistency of a database, a dump, or a backup.
6+
The `neo4j-admin` tool is located in the _/bin_ directory.
7+
8+
== Syntax
9+
10+
The `neo4j-admin database check` command has the following syntax:
11+
12+
[source,role=noheader]
13+
----
14+
neo4j-admin database check [-h] [--expand-commands] [--force] [--verbose]
15+
[--check-counts[=true|false]] [--check-graph[=true|false]]
16+
[--check-indexes[=true|false]] [--check-property-owners[=true|false]]
17+
[--additional-config=<file>] [--max-off-heap-memory=<size>]
18+
[--report-path=<path>] [--threads=<number of threads>]
19+
[[--from-path-data=<path> --from-path-txn=<path>] | [--from-path=<path> [--temp-path=<path>]]]
20+
<database>
21+
----
22+
23+
=== Description
24+
25+
This command allows for checking the consistency of a database, a dump, or a backup.
26+
It cannot be used with a database that is currently in use.
27+
28+
Some checks can be quite expensive, so it may be useful to turn some of them off for very large databases.
29+
Increasing the heap size might be a good idea.
30+
31+
[NOTE]
32+
====
33+
It is not recommended to use an NFS to check the consistency of a database, a dump, or a backup as this slows the process down significantly.
34+
====
35+
36+
=== Parameters
37+
38+
.`neo4j-admin database check` parameters
39+
[options="header", cols="1m,3a"]
40+
|===
41+
| Parameter
42+
| Description
43+
44+
|<database>
45+
|Name of the database to check.
46+
|===
47+
48+
=== Options
49+
50+
The `neo4j-admin database check` command has the following options:
51+
52+
.`neo4j-admin database check` options
53+
[options="header", cols="5m,6a,4m"]
54+
|===
55+
| Option
56+
| Description
57+
| Default
58+
59+
| --verbose
60+
| Enable verbose output.
61+
|
62+
63+
|-h, --help
64+
|Show this help message and exit.
65+
|
66+
67+
|--expand-commands
68+
|Allow command expansion in config value evaluation.
69+
|
70+
71+
|--additional-config=<file>footnote:[See xref:neo4j-admin-neo4j-cli.adoc[]#_configuration[Tools -> Configuration] for details.]
72+
| Configuration file with additional configuration.
73+
|
74+
75+
|--force
76+
| Force a consistency check to be run, despite resources, and may run a more thorough check.
77+
|
78+
79+
|--check-indexes[=true\|false]
80+
|Perform consistency checks on indexes.
81+
|true
82+
83+
|--check-graph[=true\|false]
84+
|Perform consistency checks between nodes, relationships, properties, types, and tokens.
85+
|true
86+
87+
|--check-counts[=true\|false]
88+
| Perform consistency checks on the counts. Requires <check-graph>, and may implicitly enable <check-graph> if it were not explicitly disabled.
89+
|<check-graph>
90+
91+
| --check-property-owners[=true\|false]
92+
| Perform consistency checks on the ownership of properties. Requires <check-graph>, and may implicitly enable <check-graph> if it were not explicitly disabled.
93+
|false
94+
95+
| --report-path=<path>
96+
| Path to where a consistency report will be written. Interpreted as a directory, unless it has an extension of `.report`.
97+
| .
98+
99+
|--max-off-heap-memory=<size>
100+
| Maximum memory that `neo4j-admin` can use for page cache and various caching data structures to improve performance.
101+
Value can be plain numbers, like `10000000` or e.g. `20G` for 20 gigabytes, or even e.g. `70%`, which will amount to 70% of currently free memory on the machine.
102+
|90%
103+
104+
|--threads=<number of threads>
105+
|Number of threads used to check the consistency.
106+
|The number of CPUs on the machine.
107+
108+
|--from-path-data=<path>
109+
|Path to the databases directory, containing the database directory to source from.
110+
| xref:configuration/configuration-settings.adoc#config_server.directories.data, [`server.directories.data`]/databases
111+
112+
|--from-path-txn=<path>
113+
|Path to the transactions directory, containing the transaction directory for the database to source from.
114+
| xref:configuration/configuration-settings.adoc#config_server.directories.transaction.logs.root[`server.directories.transaction.logs.root`]
115+
116+
|--from-path=<path>
117+
|Path to the directory containing dump/backup artifacts that need to be checked for consistency. If the directory contains multiple backups, it will select the most recent backup chain, based on the transaction IDs found, to perform the consistency check.
118+
|
119+
120+
|--temp-path=<path>
121+
|Path to directory to be used as a staging area to extract dump/backup artifacts, if needed.
122+
|<from-path>
123+
|===
124+
125+
[NOTE]
126+
====
127+
The `--from-path=<path>` option can also check database artifacts in AWS S3 buckets and Google Cloud storage buckets.
128+
For more information, see <<check-database-from-cloud-uris>>.
129+
====
130+
131+
== Output
132+
133+
If the consistency checker does not find errors, it exits cleanly and does not produce a report.
134+
If the consistency checker finds errors, it exits with an exit code other than `0` and writes a report file with a name in the format `inconsistencies-YYYY-MM-DD.HH24.MI.SS.report`.
135+
The location of the report file is the current working directory, or as specified by the parameter `report-path`.
136+
137+
== Examples
138+
139+
The following are examples of how to check the consistency of a database, a dump, or a backup.
140+
141+
[NOTE]
142+
====
143+
`neo4j-admin database check` cannot be applied to xref:database-administration/composite-databases/concepts.adoc[Composite databases].
144+
It must be run directly on the databases that are associated with that Composite database.
145+
====
146+
147+
=== Check the consistency of a local database
148+
149+
Note that the database must be stopped first.
150+
151+
[source,shell]
152+
----
153+
bin/neo4j-admin database check neo4j
154+
----
155+
156+
The output will look similar to the following:
157+
158+
[source,shell]
159+
----
160+
Running consistency check with max off-heap:618.6MiB
161+
Store size:160.0KiB
162+
Allocated page cache:160.0KiB
163+
Off-heap memory for caching:618.5MiB
164+
ID Generator consistency check
165+
.................... 10%
166+
.................... 20%
167+
.................... 30%
168+
.................... 40%
169+
.................... 50%
170+
.................... 60%
171+
.................... 70%
172+
.................... 80%
173+
.................... 90%
174+
.................... 100%
175+
Index structure consistency check
176+
.................... 10%
177+
.................... 20%
178+
.................... 30%
179+
.................... 40%
180+
.................... 50%
181+
.................... 60%
182+
.................... 70%
183+
.................... 80%
184+
.................... 90%
185+
.................... 100%
186+
Consistency check
187+
.................... 10%
188+
.................... 20%
189+
.................... 30%
190+
.................... 40%
191+
.................... 50%
192+
.................... 60%
193+
.................... 70%
194+
.................... 80%
195+
.................... 90%
196+
.................... 100%
197+
198+
----
199+
200+
=== Check the consistency of a backup/dump
201+
202+
Run with the `--from-path` option to check the consistency of a backup or a dump:
203+
204+
[source,shell]
205+
----
206+
bin/neo4j-admin database check --from-path=<directory-with-backup-or-dump> neo4j
207+
----
208+
209+
[[check-database-from-cloud-uris]]
210+
=== Check the consistency of a backup/dump stored in a cloud storage
211+
212+
The following examples show how to check the consistency of a backup or a dump stored in a cloud storage bucket using the `--from-path` option.
213+
214+
[.tabbed-example]
215+
=====
216+
[.include-with-AWS-S3]
217+
======
218+
219+
include::partial$/aws-s3-overrides.adoc[]
220+
221+
include::partial$/aws-s3-credentials.adoc[]
222+
223+
. Run the `bin/neo4j-admin database check` command to check the consistency of your database located in your AWS S3 storage bucket.
224+
The example assumes that you have backup or dump artifacts located in the `myBucket/myDirectory` folder in your bucket.
225+
+
226+
[source, shell, role=noplay]
227+
----
228+
bin/neo4j-admin database check mydatabase --from-path=s3://myBucket/myDirectory/
229+
----
230+
======
231+
232+
[.include-with-Google-cloud-storage]
233+
======
234+
235+
include::partial$/gcs-credentials.adoc[]
236+
237+
. Run the `bin/neo4j-admin database check` command to check the consistency of your database located in your Google storage bucket.
238+
The example assumes that you have backup or dump artifacts located in the `myBucket/myDirectory` folder in your bucket.
239+
+
240+
[source,shell]
241+
----
242+
bin/neo4j-admin database check mydatabase --from-path=gs://myBucket/myDirectory/
243+
----
244+
======
245+
246+
[.include-with-Azure-cloud-storage]
247+
======
248+
249+
include::partial$/azb-credentials.adoc[]
250+
251+
. Run the `bin/neo4j-admin database check` command to check the consistency of your database located in your Azure blob storage container.
252+
The example assumes that you have backup or dump artifacts located in the `myStorageAccount/myContainer/myDirectory` folder in Azure.
253+
+
254+
[source,shell]
255+
----
256+
bin/neo4j-admin database check mydatabase --from-path=azb://myStorageAccount/myContainer/myDirectory/
257+
----
258+
======
259+
=====
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
:description: How to remove cluster state data from a Neo4j server using `neo4j-admin server unbind`.
2+
[role=enterprise-edition]
3+
[[neo4j-admin-unbind]]
4+
= Unbind a server
5+
6+
You can use the `neo4j-admin server unbind` command to remove and archive the cluster state of a cluster server so that it can rebind to a cluster.
7+
8+
[WARNING]
9+
====
10+
Running the `unbind` command on any number of servers may result in the loss of cluster quorum, severely affecting clustering functionality.
11+
Therefore, it is strongly recommended to consult with Neo4j Support before using the `unbind` command.
12+
13+
Use the `unbind` command only when troubleshooting **a specific server** and remember there is no guarantee that the allocator will reassign the same databases to this server, potentially resulting in orphaned database stores.
14+
15+
The `unbind` command preserves all database stores on the server; and when the unbound server is restarted and enabled, it is seen as an entirely new server.
16+
====
17+
18+
[[unbind-command-syntax]]
19+
== Syntax
20+
21+
The `neo4j-admin server unbind` command has the following syntax:
22+
23+
----
24+
neo4j-admin server unbind [-h] [--expand-commands] [--verbose]
25+
[--archive-cluster-state[=true|false]]
26+
[--additional-config=<file>]
27+
[--archive-path=<path>]
28+
----
29+
30+
[[unbind-command-options]]
31+
== Options
32+
33+
The `neo4j-admin server unbind` command has the following options:
34+
35+
.`neo4j-admin server unbind` options
36+
[options="header", cols="5m,6a,2m"]
37+
|===
38+
| Option
39+
| Description
40+
| Default
41+
42+
|--additional-config=<file>footnote:[See xref:neo4j-admin-neo4j-cli.adoc[]#_configuration[Tools -> Configuration] for details.]
43+
|Configuration file with additional configuration.
44+
|
45+
46+
|--archive-cluster-state[=true\|false]
47+
|Enable or disable the cluster state archiving.
48+
|false
49+
50+
|--archive-path=<path>
51+
|Destination (file or folder) of the cluster state archive.
52+
|
53+
54+
|--expand-commands
55+
|Allow command expansion in config value evaluation.
56+
|
57+
58+
|-h, --help
59+
|Show this help message and exit.
60+
|
61+
62+
|--verbose
63+
|Enable verbose output.
64+
|
65+
|===
66+
67+
[[unbind-command-limitatations]]
68+
== Limitations
69+
70+
The Neo4j server must be shut down before running the `neo4j-admin server unbind` command.
71+
72+
[[unbind-command-usage]]
73+
== Usage
74+
75+
You can use the `neo4j-admin server unbind` command to remove the cluster state of a cluster server, turn a cluster server into a standalone server, or remove and archive the cluster state of a cluster server.
76+
77+
=== Remove the cluster state of a server
78+
79+
To remove the cluster state of a server, run the `neo4j-admin server unbind` command from the _<NEO4J_HOME>_ folder of that server.
80+
When restarted, an unbound server rejoins the cluster as a new server and has to be enabled using the `ENABLE SERVER` command.
81+
82+
=== Turn a cluster member into a standalone server
83+
84+
To start the Neo4j server in single (standalone) mode after unbinding it from the cluster, verify that xref:configuration/configuration-settings.adoc#config_initial.server.mode_constraint[`initial.server.mode_constraint`] is set to `NONE` in xref:configuration/neo4j-conf.adoc[The neo4j.conf file].
85+
86+
=== Archive cluster state
87+
88+
If something goes wrong and debugging is needed, you can archive the cluster state, from the _<NEO4J_HOME>_ folder, run the `neo4j-admin server unbind` command with the arguments `--archive-cluster-state=true` and `--archive-path=<destination-folder>`:
89+
90+
[source, shell]
91+
----
92+
bin/neo4j-admin server unbind --archive-path=/path/to/archive-folder --archive-cluster-state=true
93+
----
94+
95+
The default resultant file is named:
96+
97+
[result]
98+
----
99+
unbound_cluster_state.<YYYYMMDDHH24MM>.zip
100+
----

0 commit comments

Comments
 (0)