Memgraph logo
Back to blog
Migrating a Neo4j Database to Memgraph: A Step-by-Step Guide Using Compare41

Migrating a Neo4j Database to Memgraph: A Step-by-Step Guide Using Compare41

By Ryan John Velasco
4 min readJuly 31, 2024

Migrating from one database system to another can be a daunting task, especially when dealing with graph databases like Neo4j and Memgraph. Fortunately, now there is Compare41 which makes this process easy.

This guide will walk you through the steps to migrate your Neo4j database to Memgraph using Compare41 Platinum edition. By the end of this guide, you'll have a clear understanding of how to execute the migration smoothly with Compare41 and ensure that your data and schema are accurately migrated.

Prerequisites

Before we start, make sure you have the following:

  1. Neo4j Database: Your existing Neo4j database should be up and running. In this article we use the Network Database. If you want to follow along you can find a backup of it here.
  2. Memgraph Database: Set up an empty Memgraph database where the data will be migrated. Check out Memgraph docs.
  3. Compare41 Platinum Edition: Download and install Compare41 Platinum edition from the official website. (Note: The migration feature is only available in the Platinum edition. The free trial cannot migrate a Neo4j Database to Memgraph)
  4. Memory: You need to have enough memory on the Memgraph target machine. In our experience you need at least 1.75 times the Neo4j database folder size. For optimal performance, also configure your Neo4j source database heap and page cache correctly.

Step-by-Step Guide

Step 1: Download Compare41

First, you need to download Compare41 from the official website. Install the application on your system, and you're ready to start the migration process.

Step 2: Create a New Cross-Database Project & Configure It

  1. Open Compare41 and create a cross-database project.

  2. Set Neo4j as the left database and Memgraph as the right database (ensure Memgraph is empty). compare41-migrate-from-neo4j-to-memgraph

  3. Assign ‘uuid’ as the key. This common key will be used to match records during the migration process. If you are using a different database than the network database, you can find more information about how to set up your keys here.

memgraph-and-neo4j-database-migration-mapping

  1. Once configured, press the Compare button.

Step 3: Compare Databases

In the Compare tab, you will then see statistics of the nodes and relationships. This gives you an overview of the differences and similarities between your Neo4j and Memgraph databases.

memgraph-and-neo4j-migration-compare-databases

Step 4: Sync the Data

  1. Add all nodes and all relationships to the sync queue. This queue will contain all the entities that need to be synchronized from Neo4j to Memgraph.

memgraph-and-neo4j-migration-sync-data

  1. Click Sync Preview to see all the entities that will be synced. The application also supports sub-graphs, which might be helpful if you only want to migrate a portion of your database. You can find more information about configuring sub-graphs here.
  2. Once all entities are in the sync queue, Click the Sync button.

memgraph-and-neo4j-migration-sync-preview

  1. Confirm that you want to start synchronization. Compare41 will then synchronize all the data from Neo4j to Memgraph.

memgraph-and-neo4j-migration-confirm-sync

Step 6: Verify the Migration

  1. After the synchronization is complete, go back to the mapping tab to verify that both databases now have the same schema.

memgraph-and-neo4j-migration-verify-migration

  1. Return to the compare tab to verify that all records have been successfully synchronized. This final verification step ensures data consistency and completeness.

memgraph-and-neo4j-migration-final-verification-step

Benefits of Using Compare41 for Migration

  • Efficiency - Compare41 automates the migration process, reducing the time and effort required.
  • Accuracy - The tool ensures that all nodes and relationships are accurately migrated, maintaining data integrity.
  • Flexibility - Support for sub-graphs allows for partial migrations, which can be useful for testing or more advanced migrations.

Conclusion

Migrating from Neo4j to Memgraph can be seamless with the right tool. Compare41 Platinum edition provides a robust solution for this task, ensuring that your data and schema are accurately and efficiently synchronized. Follow the steps outlined in this guide to achieve a successful migration, and enjoy the benefits of your newly migrated Memgraph database.

For further assistance or advanced configurations, refer to the Compare41 documentation or reach out for support on Discord or via email. Happy migrating!

Join us on Discord!
Find other developers performing graph analytics in real time with Memgraph.
© 2024 Memgraph Ltd. All rights reserved.