HugeGraph【部署】Linux单机部署
注: hugegraph从版本1.5.0开始需要 Java11 运行时环境一、安装JDK111.下载JDK11https://www.oracle.com/java/technologies/downloads/#java112.解压缩包tar -zxvf jdk-11.0.27_linux-x64_bin.tar.gz3.修改/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-Server1.下载https://downloads.apache.org/incubator/hugegraph/1.5.0/apache-hugegraph-incubating-1.5.0.tar.gz2.解压缩包tar -zxvf apache-hugegraph-incubating-1.5.0.tar.gz3.以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.propertiesstore 是数据库名如果没有会被自动创建backendmysql serializermysql storehugegraph # mysql backend config jdbc.drivercom.mysql.cj.jdbc.Driver jdbc.urljdbc:mysql://127.0.0.1:3306 jdbc.username jdbc.password jdbc.reconnect_max_times3 jdbc.reconnect_interval3 jdbc.ssl_modefalse3.3配置账号密码可以跳过配置gremlin-server.yaml文件vim conf/gremlin-server.yaml #最下面添加 authentication: { authenticator: org.apache.hugegraph.auth.StandardAuthenticator, authenticationHandler: org.apache.hugegraph.auth.WsAndHttpBasicAuthHandler, config: {tokens: conf/rest-server.properties} }配置rest-server.properties文件vim conf/rest-server.properties #最下面添加 auth.authenticatororg.apache.hugegraph.auth.StandardAuthenticator auth.graph_storehugegraph配置hugegraph.properties文件vim conf/graphs/hugegraph.properties #替换掉第一行的内容 #gremlin.graphorg.apache.hugegraph.HugeFactory gremlin.graphorg.apache.hugegraph.auth.HugeFactoryAuthProxy3.4初始化数据库初始化数据库如果配置了3.3此时会让你添加密码手动输入密码未配置则是无账号密码bin/init-store.sh测试密码 curl -u admin:passwd http://localhost:8080/graphs/hugegraph/schema/vertexlabels注意事项官方的init-store.sh脚本写的不够健壮可能会判断1.9jdk11,请强制赋值需要单独把这行拿出来DEFAULT_JAVA_OPTIONS--add-exportsjava.base/jdk.internal.reflectALL-UNNAMED3.5修改访问ip配置conf下的rest-server.properties修改restserver.urlhttp://0.0.0.0:8080如果不想配置账号密码也可以配置多个ip白名单restserver.urlshttp://0.0.0.0:8080,http://192.168.1.100:8080,http://10.0.0.5:80804.启动4.1启动 serverbin/start-hugegraph.sh Starting HugeGraphServer... Connecting to HugeGraphServer (http://127.0.0.1:8080/graphs)....OK4.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.gz2.解压缩包tar -xvf apache-hugegraph-toolchain-incubating-1.5.0.tar.gz3.启动进入Hubber 的 bin 目录并执行 start-hubble.sh 脚本bash start-hubble.sh4.访问127.0.0.1:8088

相关新闻