Use Exchange¶
This article introduces the generally-used procedure on how to use Exchange to import data from a specified source to Nebula Graph.
Prerequisites¶
To import data with Exchange, do a check of these:
- Nebula Graph is deployed and started. Get the information:
- IP addresses and ports of the Graph Service and the Meta Service.
- A Nebula Graph account with the privilege of writing data and its password.
- Exchange is compiled. For more information, see Compile Exchange.
- Spark is installed.
- Get the necessary information for schema creation in Nebula Graph, including tags and edge types.
Procedure¶
To import data from a source to Nebula Graph, follow these steps:
-
Create a graph space and a schema in Nebula Graph.
-
(Optional) Process the source data. For example, to import data from a Neo4j database, create indexes for the specified tags in Neo4j to export the data from Neo4j more quickly.
-
Edit the configuration file for Spark, Nebula Graph, vertices, and edges.
NOTE: After compiling of Exchange, refer to the example configuration files in the
nebula-java/tools/exchange/target/classes
directory for the configuration for different sources. -
(Optional) Run the import command with the
-D
parameter to verify the configuration. For more information, see Import command parameters. -
Run the import command to import data into Nebula Graph.
-
Verify the imported data in Nebula Graph.
-
(Optional) Create and rebuild indexes in Nebula Graph.
For more information, see the examples: