AsterDB is a robust and versatile graph database that supports Gremlin query language facilitating various graph applications.
AsterDB provides two high-level features:
- AsterDB utilizes a hybrid mechanism to handle edge insertions and deletions with optimized I/O efficiency..
- AsterDB exploits the skewness of graph data to encode the key-value entries concisely and effectivel.
export USER_HOME_PATH=/path/to/user/directory
# install g++-10, make, libboost-all-dev
sudo apt-get update
sudo apt-get install g++-10 make libboost-all-dev -y
ln -s /usr/bin/g++-10 /usr/bin/g++
# install openjdk-11
sudo apt-get install openjdk-11-jdk
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
# install maven
mkdir /usr/local/maven/
mkdir $USER_HOME_PATH/.m2/ && mkdir $USER_HOME_PATH/.m2/repository
wget https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz
tar -xvzf apache-maven-3.9.9-bin.tar.gz -C /usr/local/maven
Clone this repo:
cd $USER_HOME_PATH
git clone --recurse-submodules https://github.com/NTU-Database-Group/AsterDB.git
Build LSM-Tree based graph storage engine for AsterDB:
cd $USER_HOME_PATH/AsterDB/GraphKV
sudo make -j8 install-static DEBUG_LEVEL=0 DISABLE_WARNING_AS_ERROR=1 EXTRA_CXXFLAGS=-fPIC JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
sudo make -j8 install-shared DEBUG_LEVEL=0 DISABLE_WARNING_AS_ERROR=1 EXTRA_CXXFLAGS=-fPIC JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
sudo make -j8 rocksdbjava DEBUG_LEVEL=0 DISABLE_WARNING_AS_ERROR=1 EXTRA_CXXFLAGS=-fPIC JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
Build gremlin console for AsterDB:
cd $USER_HOME_PATH/AsterDB/
mvn install:install-file \
-Dfile=GraphKV/java/target/rocksdbjni-8.9.0-linux64.jar \
-DgroupId=org.rocksdb \
-DartifactId=rocksdbjni \
-Dversion=8.9.0 \
-Dpackaging=jar \
-DlocalRepositoryPath=/root/.m2/repository
mvn clean install -pl tinkergraph-gremlin,gremlin-console -Dmaven.test.skip=true
TODO: upload pre-build image to docker hub
Clone this repo:
cd $USER_HOME_PATH
git clone --recurse-submodules https://github.com/NTU-Database-Group/AsterDB.git
Build docker image:
docker build -t asterdb:v1.0 .
Prepare your dataset for testing, e.g.
# cur dir: $USER_HOME_PATH
mkdir datasets && cd datasets
wget https://snap.stanford.edu/data/bigdata/communities/com-orkut.ungraph.txt.gz
gzip -d com-orkut.ungraph.txt.gz
# delete graph info lines if necessary
sed '1,4d' com-orkut.ungraph.txt > temp_file && mv temp_file com-orkut.ungraph.txt
tips: For each row in graph dataset file, the format should be:
<source_id> <dest_id>
Load dataset into AsterDB instance:
# cur dir: $USER_HOME_PATH/AsterDB/
g++ ./GraphKV/tools/bulkload.cc -O3 -std=c++17 -lrocksdb -lgflags -o ./bin/bulkload
export WRITE_SST_PATH=/udf/sst/file/path
./bin/bulkload -dataset=../datasets/com-dblp.ungraph.txt -is_undirected=true -write_sst_path=$WRITE_SST_PATH
Try AsterDB with gremlin console in a interactive way:
bin/gremlin.sh
\,,,/
(o o)
-----oOOo-(3)-oOOo-----
plugin activated: tinkerpop.server
plugin activated: tinkerpop.utilities
plugin activated: tinkerpop.tinkergraph
gremlin> conf = new BaseConfiguration();
==>org.apache.commons.configuration2.BaseConfiguration@52454457
gremlin> conf.setProperty("updatePolicy", 2); # adaptive
==>null
gremlin> graph = TinkerGraph.open(conf);
using update policy: 2
==>tinkergraph[vertices:12290508 edges:937480664]
gremlin> g = graph.traversal();
==>graphtraversalsource[tinkergraph[vertices:12290508 edges:937480664], standard]
gremlin> g.V().id().fold().next();
...
You can also implement your own graph algorithm with groovy scripts, here is an example:
# cur dir: $USER_HOME_PATH/AsterDB/
./bin/gremlin.sh -e ./scripts/bfs.groovy
mount directory /tmp/demo/
(db path) for data persistence:
docker run -it --name asterdb_container -v /tmp/demo:/tmp/demo asterdb:v1.0