14.2. Consistency checker

This section describes the Neo4j consistency checker.

The consistency of a database or a backup can be checked using the check-consistency argument to the neo4j-admin tool.

It is not recommended to use an NFS to check the consistency of a database or a backup as this slows the process down significantly.

14.2.1. Check consistency of a database or a backup

The neo4j-admin tool is located in the bin directory. Run it with the check-consistency argument in order to check the consistency of a database.

Syntax

neo4j-admin check-consistency ([--database=<database>] | [--backup=<path>]) [--verbose] [--additional-config=<path>] [--check-graph=<true/false>] [--check-indexes=<true/false>] [--check-index-structure=<true/false>] [--check-label-scan-store=<true/false>] [--check-property-owners=<true/false>] [--report-dir=<path>]

Options

Option Default Description

--database

neo4j

Name of database.

--backup

 

Path to backup to check consistency of. Cannot be used together with --database.

--additional-config

 

Configuration file to supply additional configuration in.

--verbose

false

Enable verbose output.

--report-dir

.

Directory to write report file in.

--check-graph

true

Perform checks between nodes, relationships, properties, types and tokens.

--check-indexes

true

Perform checks on indexes by comparing content with the store.

--check-index-structure

true

Perform physical structure check on indexes. No comparison with the store takes place.

--check-label-scan-store

true

Perform checks on the label scan store.

--check-property-owners

false

Perform additional checks on property ownership. This check is very expensive in time and memory.

Limitations

The consistency checker cannot be used with a database which is currently in use. If used with a running database, it will stop and print an error.

Output

If the consistency checker does not find errors, it will exit cleanly and not produce a report. If the consistency checker finds errors, it will exit with an exit code of 1 and write a report file with a name on the format inconsistencies-YYYY-MM-DD.HH24.MI.SS.report. The location of the report file is the current working directory, or as specified by the parameter report-dir.

Example 14.1. Run the consistency checker

Run with the --database option to check the consistency of a database. Note that the database must be stopped first.

$neo4j-home> bin/neo4j stop
$neo4j-home> bin/neo4j-admin check-consistency --database=neo4j

2019-11-13 12:42:14.479+0000 INFO [o.n.k.i.s.f.RecordFormatSelector] Selected RecordFormat:StandardV4_0[SF4.0.b] record format from store /data/databases/neo4j
2019-11-13 12:42:14.481+0000 INFO [o.n.k.i.s.f.RecordFormatSelector] Format not configured for store /data/databases/neo4j. Selected format from the store files: RecordFormat:StandardV4_0[SF4.0.b]
Index structure consistency check
....................  10%
....................  20%
....................  30%
....................  40%
....................  50%
....................  60%
....................  70%
....................  80%
....................  90%
.................... 100%
Full Consistency Check
....................  10%
....................  20%
....................  30%
....................  40%
....................  50%
....................  60%
....................  70%
....................  80%
....................  90%
.Checking node and relationship counts
....................  10%
....................  20%
....................  30%
....................  40%
....................  50%
....................  60%
....................  70%
....................  80%
....................  90%
.................... 100%

Run with the --backup option to check the consistency of a backup.

bin/neo4j-admin check-consistency --backup backup/neo4j-backup