欢迎访问 生活随笔!

生活随笔

当前位置: 首页 > 编程资源 > 编程问答 >内容正文

编程问答

HugeGraph Server/Hubble安装使用

发布时间:2024/8/23 编程问答 42 豆豆
生活随笔 收集整理的这篇文章主要介绍了 HugeGraph Server/Hubble安装使用 小编觉得挺不错的,现在分享给大家,帮大家做个参考.

文章目录

  • HugeGraph Server
    • 1 概述
    • 2 依赖
      • 2.1 安装JDK-1.8
    • 3 部署
      • 3.1 下载tar包
    • 4 安装启动
      • 4.1 解压
      • 4.2 配置Hbase
    • 5 访问Server
      • 5.1 服务启动状态校验
    • 6 停止Server
    • 7 多图配置
  • HugeGraph-Hubble 基于Web的可视化图形界面
    • 1.概述
    • 2.安装
    • 3 使用
      • 3.1创建图

HugeGraph Server

1 概述

HugeGraph-Server 是 HugeGraph 项目的核心部分,包含Core、Backend、API等子模块。

Core模块是Tinkerpop接口的实现,Backend模块用于管理数据存储,目前支持的后端包括:Memory、Cassandra、ScyllaDB以及RocksDB,API模块提供HTTP Server,将Client的HTTP请求转化为对Core的调用。

文档中会大量出现HugeGraph-Server及HugeGraphServer这两种写法,其他组件也类似。这两种写法含义上并无大的差异,可以这么区分:HugeGraph-Server表示服务端相关组件代码,HugeGraphServer表示服务进程。

2 依赖

2.1 安装JDK-1.8

HugeGraph-Server 基于jdk-1.8开发,代码用到了较多jdk-1.8中的类和方法,请用户自行安装配置。

在往下阅读之前务必执行java -version命令查看jdk版本

3 部署

有三种方式可以部署HugeGraph-Server组件:

  • 方式1:一键部署
  • 方式2:下载tar包
  • 方式3:源码编译

这里我们只介绍下载tar包方式,其他方式参考官方文档
https://hugegraph.github.io/hugegraph-doc/quickstart/hugegraph-server.html

3.1 下载tar包

wget https://github.com/hugegraph/hugegraph/releases/download/v${version}/hugegraph-${version}.tar.gz tar -zxvf hugegraph-${version}.tar.gz

也可以在 https://hugegraph.github.io/hugegraph-doc/download.html 下载

这里我们使用0.11.2版本安装

4 安装启动

启动分为"首次启动"和"非首次启动",这么区分是因为在第一次启动前需要初始化后端数据库,然后启动服务。 而在人为停掉服务后,或者其他原因需要再次启动服务时,因为后端数据库是持久化存在的,直接启动服务即可。

HugeGraphServer启动时会连接后端存储并尝试检查后端存储版本号,如果未初始化后端或者后端已初始化但版本不匹配时(旧版本数据),HugeGraphServer会启动失败,并给出错误信息。

如果需要外部访问HugeGraphServer,请修改rest-server.properties的restserver.url配置项 (默认为http://127.0.0.1:8080),修改成机器名或IP地址。

由于各种后端所需的配置(hugegraph.properties)及启动步骤略有不同,下面逐一对各后端的配置及启动做介绍。

4.1 解压

tar -zxvf hugegraph-0.11.2.tar.gz

4.2 配置Hbase

> vim conf/hugegraph.properties backend=hbase serializer=hbase # hbase backend config hbase.hosts=10.8.11.12 hbase.port=2181 hbase.znode_parent=/hbase-unsecure

初始化数据库(仅第一次启动时需要)

cd hugegraph-${version} bin/init-store.sh

提示如下结果并且无报错则成功

2021-11-02 21:05:37 24754 [Thread-1] [INFO ] com.baidu.hugegraph.HugeGraph [] - HugeGraph is shutting down Initialization finished.

启动server

[hugegraph-0.11.2]# bin/start-hugegraph.sh Starting HugeGraphServer... Connecting to HugeGraphServer (http://0.0.0.0:8080/graphs).......OK Started [pid 14169]

5 访问Server

5.1 服务启动状态校验

jps查看服务进程

# jps 6475 HugeGraphServer

curl请求RESTfulAPI

echo `curl -o /dev/null -s -w %{http_code} "http://localhost:8080/graphs/hugegraph/graph/vertices"`

返回结果200,代表server启动正常

6 停止Server

$cd hugegraph-${version} $bin/stop-hugegraph.sh

7 多图配置

rest-server.properties配置自己新增的图配置文件jast_graph.properties

> vim rest-server.properties # graphs list with pair NAME:CONF_PATH graphs=[hugegraph:conf/hugegraph.properties,jast_graph:conf/jast_graph.properties]

创建配置文件jast_graph.properties

# 修改为自己图的名称,其他的图配置与之前配置方法相同 store=jast_graph

修改gremlin-server.yaml

> vim gremlin-server.yaml # 新增jast_graph 配置文件 graphs: {jast_graph: conf/jast_graph.properties,hugegraph: conf/hugegraph.properties }

我们这里配置的hbase,需要再次执行bin/init-store.sh
重启服务

[root@node3 hugegraph-0.11.2]# bin/stop-hugegraph.sh no crontab for root The HugeGraphServer monitor has been closed Killing HugeGraphServer(pid 14169)...OK [root@node3 hugegraph-0.11.2]# bin/start-hugegraph.sh Starting HugeGraphServer... Connecting to HugeGraphServer (http://0.0.0.0:8080/graphs).......OK Started [pid 25522]

HugeGraph-Hubble 基于Web的可视化图形界面

1.概述

HugeGraph-Hubble 是HugeGraph的一站式可视化分析平台,平台涵盖了从数据建模,到数据快速导入,再到数据的在线、离线分析、以及图的统一管理的全过程,实现了图应用的全流程向导式操作,旨在提升用户的使用流畅度,降低用户的使用门槛,提供更为高效易用的使用体验。

2.安装

解压hubble包
tar -zxvf hugegraph-hubble-1.5.0.tar.gz
修改配置文件

# vi conf/hugegraph-hubble.propertiesserver.host=0.0.0.0 server.port=38088gremlin.suffix_limit=250 gremlin.vertex_degree_limit=100 gremlin.edges_total_limit=500 gremlin.batch_query_ids=100

启动Hubble

[root@ hugegraph-hubble-1.5.0]# bin/start-hubble.sh starting HugeGraphHubble.....OK logging to /graph/hugegraph-hubble-1.5.0/logs/hugegraph-hubble.log

查看Hubble日志

# tailf logs/hugegraph-hubble.log 2021-11-02 21:19:15.319 INFO 33495 --- [ main] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2021-11-02 21:19:15.838 INFO 33495 --- [ main] com.zaxxer.hikari.HikariDataSource : hugegraph-hubble-HikariCP - Starting... 2021-11-02 21:19:16.074 INFO 33495 --- [ main] com.zaxxer.hikari.HikariDataSource : hugegraph-hubble-HikariCP - Start completed. 2021-11-02 21:19:18.913 INFO 33495 --- [ main] com.baidu.hugegraph.HugeGraphHubble : Started HugeGraphHubble in 7.045 seconds (JVM running for 7.543) 2021-11-02 21:19:18.932 INFO 33495 --- [ main] c.b.h.handler.CustomApplicationRunner : The server info has been inited 2021-11-02 21:19:19.006 INFO 33495 --- [ main] java.util.prefs : Created user preferences directory. 2021-11-02 21:19:19.123 INFO 33495 --- [ main] com.baidu.hugegraph.HugeGraphHubble : The license is successfully installed, valid for Sun Sep 01 00:00:00 CST 2019 - Sat Sep 01 00:00:00 CST 2029 2021-11-02 21:19:19.484 INFO 33495 --- [.0-38088-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet' CST 2019 - Sat Sep 01 00:00:00 CST 2029 2021-11-02 21:19:19.484 INFO 33495 --- [http-nio-0.0.0.0-38088-exec-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring DispatcherServlet 'dispatcherServlet'

访问hubble http://${ip}:38088/
出现以下页面可以正式使用了

3 使用

3.1创建图

图ID:随意取个值
图名称:hugegraph(我们配置的图名称,在gremlin-server.yaml中配置的graphs值)
主机名:0.0.0.0
端口号:HugeGraph-Server所配置的端口号(即${port})
用户名:空
密码:空

gremlin-server.yaml中我们配置了两个图,分别为jast_graph与hugegraph


如果没配置的图创建则会报错,提示没有该图

总结

以上是生活随笔为你收集整理的HugeGraph Server/Hubble安装使用的全部内容,希望文章能够帮你解决所遇到的问题。

如果觉得生活随笔网站内容还不错,欢迎将生活随笔推荐给好友。