Migrating a Neo4j Database to Memgraph: A Step-by-Step Guide Using Compare41
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:
- 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.
- Memgraph Database: Set up an empty Memgraph database where the data will be migrated. Check out Memgraph docs.
- 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)
- 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
-
Open Compare41 and create a cross-database project.
-
Set Neo4j as the left database and Memgraph as the right database (ensure Memgraph is empty).
-
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.
- 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.
Step 4: Sync the Data
- 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.
- 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.
- Once all entities are in the sync queue, Click the Sync button.
- Confirm that you want to start synchronization. Compare41 will then synchronize all the data from Neo4j to Memgraph.
Step 6: Verify the Migration
- After the synchronization is complete, go back to the mapping tab to verify that both databases now have the same schema.
- Return to the compare tab to verify that all records have been successfully synchronized. This final verification step ensures data consistency and completeness.
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!