注: hugegraph從版本?
1.5.0
?開始,需要 Java11 運行時環境
一、安裝JDK11
1.下載JDK11
https://www.oracle.com/java/technologies/downloads/#java11
2.解壓縮包
tar -zxvf jdk-11.0.27_linux-x64_bin.tar.gz
?3.修改/etc/profile環境變量
export JAVA_HOME=/usr/local/jdk-11.0.27
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${JAVA_HOME}/bin:${JRE_HOME}/bin
export PATH=$PATH:${JAVA_PATH}
4.文件生效
source /etc/profile
?二、安裝hugegraph-Server
1.下載
https://downloads.apache.org/incubator/hugegraph/1.5.0/apache-hugegraph-incubating-1.5.0.tar.gz
2.解壓縮包
tar -zxvf apache-hugegraph-incubating-1.5.0.tar.gz
?3.以mysql為數據源進行配置
?3.1下載mysql驅動
https://repo1.maven.org/maven2/mysql/mysql-connector-java/8.0.30/mysql-connector-java-8.0.30.jar
比如 mysql-connector-java-8.0.30.jar,并放入 HugeGraph-Server 的 lib 目錄下
??3.2修改mysql配置
vim /apache-hugegraph-incubating-1.5.0/conf/graphs/hugegraph.properties
?store 是數據庫名,如果沒有會被自動創建
backend=mysql
serializer=mysqlstore=hugegraph# mysql backend config
jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306
jdbc.username=
jdbc.password=
jdbc.reconnect_max_times=3
jdbc.reconnect_interval=3
jdbc.ssl_mode=false
3.3初始化數據庫
初始化數據庫(第一次啟動時或在 conf/graphs/ 下手動添加了新配置時需要進行初始化)
bin/init-store.sh
3.4修改配置
conf下的rest-server.properties修改restserver.url=http://0.0.0.0:8080
?4.啟動
4.1啟動 server
bin/start-hugegraph.sh
Starting HugeGraphServer...
Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK
?4.2啟動 server--創建示例圖
bin/start-hugegraph.sh -p true
Starting HugeGraphServer in daemon mode...
Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)......OK
使用 RESTful API 請求 HugeGraphServer 如果得到如下結果,則表示部署成功
> curl "http://localhost:8080/graphs/hugegraph/graph/vertices" | gunzip{"vertices":[{"id":"2:lop","label":"software","type":"vertex","properties":{"name":"lop","lang":"java","price":328}},{"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":"2:ripple","label":"software","type":"vertex","properties":{"name":"ripple","lang":"java","price":199}}]}
三、 安裝Hubble可視化界面
?1.下載
https://downloads.apache.org/incubator/hugegraph/1.5.0/apache-hugegraph-toolchain-incubating-1.5.0.tar.gz
?2.解壓縮包
tar -xvf apache-hugegraph-toolchain-incubating-1.5.0.tar.gz
?3.啟動
進入Hubber 的 bin 目錄,并執行 start-hubble.sh 腳本
bash start-hubble.sh
?4.訪問
127.0.0.1:8088