hugegraph-loader is a customizable command line utility for loading small to medium size graph datasets into the HugeGraph database from multiple data sources with various input formats.
- Multiple data sources, such as local file(path), HDFS file(path), MySQL
- Various input formats, such as json, csv, and text with any delimiters.
- Diverse options, with which users can manage the data loading intuitively.
- Detecting schema from data automatically, reduce the complex work of schema management.
- Advanced customized operations with groovy script, users can configure how to construct vertices and edges by themselves.
- Run
loader
with Docker- Docker run
- Docker-compose
- Load data in docker container
loader
Use the command docker run -itd --name loader hugegraph/loader
to start loader.
If you want to load your data, you can mount the data folder like -v /path/to/data/file:/loader/file
The example docker-compose.yml
is here
If you want to load your data, you can mount the data folder like:
volumes:
- /path/to/data/file:/loader/file
Use the command docker-compose up -d
to deploy loader
with server
and hubble
.
If the
loader
andserver
is in the same docker network (for example, you deployloader
andserver
withdocker-compose
), we can set-h {server_container_name}
. In our example, the container name ofserver
isgraph
If
loader
is deployed alone, the-h
should be set to the ip of the host ofserver
. Other parameter description is here
docker exec -it loader bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy -h graph -p 8080
Then we can see the result.
HugeGraphLoader worked in NORMAL MODE
vertices/edges loaded this time : 8/6
--------------------------------------------------
count metrics
input read success : 14
input read failure : 0
vertex parse success : 8
vertex parse failure : 0
vertex insert success : 8
vertex insert failure : 0
edge parse success : 6
edge parse failure : 0
edge insert success : 6
edge insert failure : 0
--------------------------------------------------
meter metrics
total time : 0.199s
read time : 0.046s
load time : 0.153s
vertex load time : 0.077s
vertex load rate(vertices/s) : 103
edge load time : 0.112s
edge load rate(edges/s) : 53
Then you can use curl
or hubble
to see the result.
> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip
{"vertices":[{"id":1,"label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328.0}},{"id":2,"label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199.0}},{"id":"1:tom","label":"person","type":"vertex","properties":{"name":"tom"}},{"id":"1:josh","label":"person","type":"vertex","properties":{"name":"josh","age":32,"city":"Beijing"}},{"id":"1:marko","label":"person","type":"vertex","properties":{"name":"marko","age":29,"city":"Beijing"}},{"id":"1:peter","label":"person","type":"vertex","properties":{"name":"peter","age":35,"city":"Shanghai"}},{"id":"1:vadas","label":"person","type":"vertex","properties":{"name":"vadas","age":27,"city":"Hongkong"}},{"id":"1:li,nary","label":"person","type":"vertex","properties":{"name":"li,nary","age":26,"city":"Wu,han"}}]}
If you want to check the edges, use curl "http://localhost:8080/graphs/hugegraph/graph/edges" | gunzip
If you want to do some additional operation in the container, you can enter the container as follows:
docker exec -it loader bash
Then, you can load data as follows:
sh bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy -h graph -p 8080
The result is as same as above.
notice: currently, version is
1.0.0
Download and unzip the compiled archive
wget https://downloads.apache.org/incubator/hugegraph/{version}/apache-hugegraph-toolchain-incubating-{version}.tar.gz
tar zxf *hugegraph*.tar.gz
Then, load data with example file:
cd apache-hugegraph-toolchain-incubating-{version}
cd apache-hugegraph-loader-incubating-{version}
sh bin/hugegraph-loader.sh -g hugegraph -f example/file/struct.json -s example/file/schema.groovy
More details is in the doc
You can also build the loader
by yourself.
Required:
- Java 8
- Maven 3.6+
To build without executing tests:
mvn clean install -DskipTests=true
To build with default tests:
mvn clean install
The loader homepage contains more information about it.
hugegraph-loader is licensed under Apache 2.0 License.