注: 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=mysql
store=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