Platform backup - neo4j - Microsoft Windows


Overview

neo4j is the native graph database management system (GDBMS) that stores and manages data generated by CAST Imaging and which is installed as part of the CAST Imaging installation process. On Microsoft Windows, the database is installed as a service running in the background.

Since this database contains valuable application result data, you may wish to consider periodically backing it up. This document explains how to do so.

Prerequisites

  • neo4j up and running as a Microsoft Windows service on the machine where the imaging-viewer component was installed.
  • sufficient free disk space for backup - this depends on the size of your neo4j database(s). You can determine this by calcuating the size of the %PROGRAMDATA%\CAST\Imaging\CAST-Imaging-Viewer\Neo4jData folder on disk: you will need an equivalent amount of free disk space to store the backup.

Step 1 - create backup folder

Create a new folder to store the backup - for example in C:\CAST\neo4j_backup.

Step 2 - create backup script

Create a batch file (.bat) and paste in the following to run the Neo4j backup tool:

set HEAP_SIZE=4G
cd %PROGRAMFILES%\CAST\Imaging\CAST-Imaging-Viewer\neo4j\bin\
neo4j-admin database backup --verbose --compress=true --include-metadata=all --pagecache=4G --to-path=C:\\CAST\\neo4j_backup --from=localhost:6372 "*" > C:\CAST\neo4j_backup\backup.log 2>&1

Where:

  • --verbose sets logging output to verbose mode.
  • --compress set this to true to ensure the backup is compressed to reduce disk space usage.
  • --include-metadata set this to all to ensure that any roles you have defined are also backed up.
  • --pagecache defaults to 8MB, so use this option to ensure you specify a large amount of RAM (e.g. 4GB) to improve performance.
  • --to-path specifies an absolute path to the target folder for the resulting backup. This folder must already exist. You must use escaped backslashes in the path.
  • --from defines the machine on which CAST Imaging is running - set this to localhost:6372. “6372” is the default listening port for neo4j backup operations in CAST Imaging v3 installed on Microsoft Windows.
  • "*" this option will backup all databases
  • > C:\\CAST\\neo4j_backup\\logs\\backup_$(date +%Y%m%d_%H%M%S).log 2>&1 use this to log the output to a .log file in the location of your choice (note that this location must already exist)

Step 3 - run the script and check results

Execute the .bat with elevated permissions (right click, Run as administrator) and check the log and resulting .backup files (one per neo4j database).