Arturo Sevilla
Arturo Sevilla

Reputation: 227

Restore from Neo4j backup using transaction logs

As far as I understand neo4j-backup does an incremental backup against a previous full backup.

Because we will probably have many data, which for auditing purposes must be maintained for a given N amount of days, it would be very costly to maintain a full backup of the database for every X amount of time in a given day (say, we need a hourly backup of the database state).

What we are doing right now is doing a full backup, store it as version 1 of the day, and then every X amount of time we do the incremental backup and only store the neostore.transaction.db.XX files (or nineo_XX for 2.1.x) as the backup for that given hourly state.

My question is: how could we restore the database for any given time of the day (version N)? If I start the database with the full backup it works, but if I grab the transaction logs up to version N of the day and copied them into the version 1 folder, the database starts, but MATCH (n) RETURN COUNT(n) returns only the amount of nodes for state 1, and even MATCH (n) RETURN n fails in the browser shell with UnknownError and returning "Node with id XX" columns.

I'm currently using 2.2.0-M02 enterprise for testing, but in theory this is applicable to 2.1.x as well

Upvotes: 2

Views: 422

Answers (1)

Michal Bachman
Michal Bachman

Reputation: 2661

The Neo4j backup feature is just that - a backup in case something goes wrong. The incremental backup is naturally faster than the full one, but I don't think it is meant to be used as a graph versioning solution.

Have a look at the Neo4j ChangeFeed Module, which may or may not be good enough for your auditing purposes. It may need to be modified to keep a certain number of days, rather than a number of past database modifications (that's what it does now).

Upvotes: 2

Related Questions