Neo4j Data Copy Utility

In order to ensure optimal performance of Neo4j (Community edition) where the deletion of nodes do not necessarily reduce the size of the DB it is proposed to copy the data files to a different location in order to reclaim the space, which has been lost. This utility is uses to copy neo4j data from one folder to another folder.

Note: This utility uses neo4j 3.5.6 instance.

Pre Requisite

  1. Apache Maven 3.5.4
  2. High end configuration machine depends on your data size.

Steps:

    1. Login to existing old Neo4j server using http://localhost:7474/browser/

    2. Run following command to copy all existing indexes.

         CALL db.indexes() YIELD description RETURN 'CREATE ' + description + ‘;’

    3. Copy all result of query in text file for future reference.        

         Sample Output

         CREATE INDEX ON :GITINSIGHTS(message);

         CREATE INDEX ON :PIVOTALTRACKER(key);

         CREATE INDEX ON :PIVOTALTRACKER(storyId);

         CREATE INDEX ON: METADATA(metadata_id);

   4. Stop old Neo4j server.

   5. Setup maven heap size  (It depends on number of node and system memory size ).

         MAVEN_OPTS="-Xmx4G -Xms4G -Xmn1G -XX:+UseG1GC"

   6. Download source code package from https://github.com/jexp/store-utils/releases/tag/3.5.6

       Example store-utils-3.5.6.tar.gz (Source code (zip) or Source code (tar.gz))

   7. Unzip package to specific directory.

   8. Run maven command.

      mvn clean install

   9. Run following command.

     ./copy-store.sh community <SourceDBPath> <targetDBPath>

     Example:

     ./copy-store.sh community D:/Project/Insights/InSights_Windows/Server1/neo4j-community-3.5.6/data/databases/graph.db

     D:/Project/Insights/InSights_Windows/Server1/neo4j-community-3.5.6-V2/data/databases/data2/graph.db

 10. For more information please check readme.md.

 11. After successfully copied, point neo4j instance to new location (target location) using neo4j.conf file, Update all other parameter as per your system configuration.

 12. Start neo4j server and verify data.

 13. Login to new neoo4j browser go to Browser Settings à User Interface à Select “Enable multi statement query editor”.

 14. Post the above step, Cypher queries separated by semi-colon (;) can be executed.

 15. Check indexes created in new DB.

Back to Top

©2021 Cognizant, all rights reserved. US Patent 10,410,152