Overview
The migration process consists of the following steps:- Set up Neo4j and prepare your data
- Review and configure mapping settings
- Extract data from Neo4j to CSV files
- Load CSV data into FalkorDB
- Validate the migrated data
Prerequisites
- Neo4j instance (local or remote)
- FalkorDB instance (local, Docker, or Cloud)
- Python 3.9+
- Migration tools from the Neo4j-to-FalkorDB repository
Step 1: Setting Up Neo4j
Follow the Neo4j documentation to set up a locally run Neo4j database. For testing purposes, you can load the Movies sample dataset by following the:guide movies command in the Neo4j browser. More details are available in the Neo4j Getting Started guide.
Step 2: Reviewing and Updating Mapping Configuration
The configuration filemigrate_config.json allows you to modify how labels and properties are represented in FalkorDB.
Generating a Configuration Template
To extract the ontology from your Neo4j database and generate a template config file:Extractor Usage
--uri URI: Neo4j URI (default: bolt://localhost:7687)--username USERNAME: Neo4j username (default: neo4j)--password PASSWORD: Neo4j password (required)--database DATABASE: Neo4j database name--batch-size BATCH_SIZE: Batch size for extraction--nodes-only: Extract only nodes--edges-only: Extract only relationships--indexes-only: Extract only indexes and constraints--config CONFIG: Path to migration configuration JSON file--generate-template GENERATE_TEMPLATE: Generate template migration config file--analyze-only: Only analyze topology, do not extract data--tenant-mode {label,property}: Enable multi-tenant mode - “label” (filter by node label) or “property” (filter by property value)--tenant-filter TENANT_FILTER: The label name or property name to use for tenant segregation (required with —tenant-mode)
Example Output
When analyzing a database, you’ll see output similar to:Step 3: Extracting Data from Neo4j
To extract data from Neo4j and generate CSV files:- Read data from Neo4j
- Create CSV files in the
csv_outputsubfolder - Generate headers and content based on the configuration
- Create both nodes and edges CSV files
- Export indexes and constraints
- Generate FalkorDB load scripts
Multi-Tenant Data Extraction
If your Neo4j database contains multi-tenant data, you can extract each tenant’s data into separate subdirectories: Using property-based tenant segregation:- Discover all distinct values of the
tenantIdproperty - Create a subdirectory for each tenant (e.g.,
csv_output/tenant_cloudserve/,csv_output/tenant_learnhub/,csv_output/tenant_shopfast/) - Export each tenant’s nodes and relationships to their respective subdirectories
- Automatically omit the
tenantIdproperty from CSV exports (since it’s encoded in the folder name)
Output Files
The extraction creates the following files in thecsv_output directory:
nodes_<label>.csv: One file per node labeledges_<type>.csv: One file per relationship typeindexes.csv: Database indexesconstraints.csv: Database constraintsload_to_falkordb.cypher: FalkorDB load scriptcreate_indexes_falkordb.cypher: Index creation script
Step 4: Loading CSV Data into FalkorDB
Setting Up FalkorDB
Set up FalkorDB on your local machine following the Getting Started guide. You can use either:- The full deployment with browser (port 3000)
- The server-only option (port 6379)
Loading Data
Load the CSV data into FalkorDB using the Python loader:graph_name: Target graph name in FalkorDB (required). When using--multi-graphmode, this serves as the prefix for tenant-specific graphs--host HOST: FalkorDB host (default: localhost)--port PORT: FalkorDB port (default: 6379)--username USERNAME: FalkorDB username (optional)--password PASSWORD: FalkorDB password (optional)--batch-size BATCH_SIZE: Batch size for loading (default: 5000)--stats: Show graph statistics after loading--csv-dir CSV_DIR: Directory containing CSV files (default: csv_output)--merge-mode: Use MERGE instead of CREATE for upsert behavior--multi-graph: Enable multi-graph mode - load each tenant_* subfolder into a separate graph
Multi-Tenant Data Loading
If you extracted multi-tenant data using the--tenant-mode option, you can load each tenant into a separate FalkorDB graph:
- Scan for
tenant_*subdirectories incsv_output/ - Create a separate graph for each tenant (e.g.,
MYAPP_shopfast,MYAPP_cloudserve,MYAPP_learnhub) - Load each tenant’s data into its own isolated graph
- Provide detailed progress reporting per tenant
Using FalkorDB-Loader-RS (Recommended for Large Datasets)
For significantly improved loading speed and performance, especially with large datasets, we recommend using the Rust-based FalkorDB CSV Loader.Features
- High Performance: Built with Rust and async/await for optimal speed
- Batch Processing: Configurable batch sizes (default: 5000 records)
- Memory Efficient: Streams data without loading everything into memory
- Automatic Schema Management: Creates indexes and constraints automatically
- Merge Mode: Support for upsert operations using MERGE instead of CREATE
- Progress Reporting: Real-time progress tracking during loading
Installation
target/release/falkordb-loader.
Basic Usage
Advanced Usage
Command-Line Options
Performance Tips
- Adjust batch size based on your data and available memory
- Enable progress reporting for long-running imports:
--progress-interval 1000 - Use merge mode if you need to update existing data:
--merge-mode - Set log level for debugging:
RUST_LOG=info ./target/release/falkordb-loader MOVIES
Example Output
Step 5: Validating Content
Validate that your data has been successfully migrated by running queries in both Neo4j and FalkorDB. Compare the results to ensure data integrity. Example query:Additional Resources
Next Steps
- Explore FalkorDB Cypher Language for querying your graph
- Learn about FalkorDB Operations for production deployments
- Check out FalkorDB Integration options
Frequently Asked Questions
Is FalkorDB fully compatible with Neo4j Cypher queries?
Is FalkorDB fully compatible with Neo4j Cypher queries?
FalkorDB supports a large subset of the Cypher query language. Most standard queries will work, but some Neo4j-specific functions or APOC procedures may need alternatives. Test queries after migration.
How long does the Neo4j to FalkorDB migration take?
How long does the Neo4j to FalkorDB migration take?
Migration time depends on dataset size. The CSV export from Neo4j and the Rust loader import into FalkorDB are both highly optimized. Datasets with millions of nodes typically complete in minutes.
Do indexes and constraints transfer from Neo4j?
Do indexes and constraints transfer from Neo4j?
Yes. The migration tool extracts Neo4j indexes and constraints and recreates them in FalkorDB during the loading step. Verify with
GRAPH.QUERY mygraph 'CALL db.indexes()' after migration.Can I migrate only specific labels or relationships?
Can I migrate only specific labels or relationships?
Yes. Use the
migrate_config.json configuration file to customize which labels and properties are included. Generate a template with --generate-template and edit it before running the export.What is the recommended batch size for loading?
What is the recommended batch size for loading?
The default batch size of 5000 works well for most datasets. For very large datasets, increase to 10000. For memory-constrained environments, reduce to 1000. Use
--progress-interval to monitor throughput.