|
| 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 | +===== |
0 commit comments