Neo4j Backup: Store copy and consistency check at Mark Needham

One of the lesser known things about the Neo4j online backup tool, which I wrote about last week, is that conceptually there are two parts to it:

  1. Copying the store files to a location of your choice
  2. Verifying that those store files are consistent.

By default both of these run when you run the ‘neo4j-backup’ script but sometimes it’s useful to be able to run them separately.

If we want to just run the copying the store files part of the process we can tell the backup tool to skip the consistency check by using the ‘verify‘ flag:

$ pwd
/Users/markneedham/Downloads/neo4j-enterprise-2.0.0
$ ./bin/neo4j-backup -from single://127.0.0.1 -to /tmp/foo -verify false
Performing full backup from 'single://127.0.0.1'
Files copied
................        done
Done

If we ran that without the ‘verify’ flag we’d see the output of the consistency checker as well:

$ ./bin/neo4j-backup -from single://127.0.0.1 -to /tmp/foo
Performing full backup from 'single://127.0.0.1'
Files copied
................        done
Full consistency check
....................  10%
....................  20%
....................  30%
....................  40%
....................  50%
....................  60%
....................  70%
....................  80%
....................  90%
.................... 100%
Done

If we already have a backup and only want to run the consistency checker we can run the following command:

$ java -cp 'lib/*:system/lib/*' org.neo4j.consistency.ConsistencyCheckTool /tmp/foo
Full consistency check
....................  10%
....................  20%
....................  30%
....................  40%
....................  50%
....................  60%
....................  70%
....................  80%
....................  90%
.................... 100%

The consistency tool itself takes a ‘config‘ flag which gives you some control over what things you want to consistency check.

The various options are defined in org.neo4j.consistency.ConsistencyCheckSettings.

For example, if we want to change the file that the consistency check report is written to we could add the following property to our config file:

$ tail -n 1 conf/neo4j.properties
consistency_check_report_file=/tmp/foo.txt

And then run the consistency tool like so:

$ java -cp 'lib/*:system/lib/*' org.neo4j.consistency.ConsistencyCheckTool -config conf/neo4j.properties /tmp/foo

If there are any inconsistencies they’ll now be written to that file rather than to a file in the store directory.

You can also pass that ‘config’ flag to the backup tool and it will make use of it when it runs the consistency check. e.g.

$ ./bin/neo4j-backup -from single://127.0.0.1 -to /tmp/foo -verify false -config conf/neo4j.properties

Most of the time you don’t need to worry too much about either of these commands but I always forget what the various options are so I thought I’d better write it up while it’s fresh in my mind.
 

Do you want to know how to develop your skillset to become a Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

JPA Mini Book

Learn how to leverage the power of JPA in order to create robust and flexible Java applications. With this Mini Book, you will get introduced to JPA and smoothly transition to more advanced concepts.

JVM Troubleshooting Guide

The Java virtual machine is really the foundation of any Java EE platform. Learn how to master it with this advanced guide!

Given email address is already subscribed, thank you!
Oops. Something went wrong. Please try again later.
Please provide a valid email address.
Thank you, your sign-up request was successful! Please check your e-mail inbox.
Please complete the CAPTCHA.
Please fill in the required fields.

Leave a Reply


three + 9 =



Java Code Geeks and all content copyright © 2010-2014, Exelixis Media Ltd | Terms of Use | Privacy Policy | Contact
All trademarks and registered trademarks appearing on Java Code Geeks are the property of their respective owners.
Java is a trademark or registered trademark of Oracle Corporation in the United States and other countries.
Java Code Geeks is not connected to Oracle Corporation and is not sponsored by Oracle Corporation.
Do you want to know how to develop your skillset and become a ...
Java Rockstar?

Subscribe to our newsletter to start Rocking right now!

To get you started we give you two of our best selling eBooks for FREE!

Get ready to Rock!
You can download the complementary eBooks using the links below:
Close