Four ways to check the consistency of a Neo4j graph
When it comes checking the inconsistencies in your graph, there are four methods to do. This article describes them below:
1. The easiest approach is it to utilize the
check-consistency=true option with the
backup command. With this approach your graph stays online and the consistency check is done along with the scheduled or adhoc backup.
neo4j-home> bin/neo4j-admin backup --backup-dir=/home/backups --name=graph.db --check-consistency=true
2. If you are not checking the consistency through the
backup command, then you will need to stop Neo4j to check its consistency.
neo4j-home> bin/neo4j stop neo4j-home> bin/neo4j-admin check-consistency --database=graph.db
3. There will be situations when you would want to test the consistency of a backup. Here is how that is done:
neo4j-home> bin/neo4j-admin check-consistency --backup=/<path-to-backup-dir>/<graph_backup.db>
4. Using the
load commands is the recommended, and safe, way of transferring databases between environments. It is possible to check the consistency of an offline dump.
Assume you have the dump file sitting in:
The dump file is a
gzipfile. To confirm the format, perform these commands:
$ cd /mnt/dump_of_db $ file graph.db.dump graph.db.dump: gzip compressed data
You will see that the
.dump file is a
Create a directory under
$ mkdir graph.db
gzipfile under the
$ cd graph.db ~/dump_of_dbs/graph.db$ tar xvzf ../graph.db.dump
Finally, run the consistency check as:
neo4j-home> bin/neo4j-admin check-consistency --backup=/mnt/dump_of_dbs/graph.db
The inconsistencies report is generated only when there are inconsistencies in the graph. So, you can have a process to trigger an alert if the report is created. The filename appears in this format:
If the inconsistencies are discovered, follow the link below and use the specific methods to resolve them: https://support.neo4j.com/hc/en-us/articles/218047648-How-do-I-resolve-Consistency-Check-errors
Was this page helpful?