hugegraph-server和HugeGraph-Hubble超详细安装部署教程(主要idea和linux压缩文件安装)

1. HugeGraph安装与使用

本章主要介绍HugeGraph图数据库HugeGraph-Server的安装与入门使用。本文使用的工作环境为:Windows11、linux(centOs7)、idea。不支持windows安装

HugeGraph官方地址:https://hugegraph.apache.org/

官方文档地址:https://hugegraph.apache.org/docs/

有三种方法可以部署HugeGraph-Server组件(主讲方法二和三):

  • 方式一:一键部署
  • 方法 二:下载压缩包
  • 方法三:源码编译

1.1. 各个模块基本介绍(详情去官网查看)

  • HugeGraph-Server:HugeGraph-Server是HugeGraph项目的核心部分,包括Core、后端和API等子模块;
    • 核心:图引擎实现,向下连接后端模块,向上支持API模块;
    • 后端:实现图数据到后端的存储。支持的后端包括:Memory,Cassandra,ScyllaDB,RocksDB,HBase,MySQL和PostgreSQL。用户可以根据实际情况选择一种;
    • API:内置 REST Server,为用户提供 RESTful API,与 Gremlin 查询完全兼容。
  • HugeGraph-Client:HugeGraph-Client 提供了一个 RESTful API 客户端,用于连接到 HugeGraph-Server。目前,仅实现Java版本。其他语言的用户可以自己实现;
  • HugeGraph-Loader:HugeGraph-Loader是一款基于HugeGraph-Client的数据导入工具,它将普通文本数据转换为图形顶点和边缘,并插入图形数据库;
  • HugeGraph-Spark:HugeGraph-Spark可以对图进行并行计算,如PageRank算法等;
  • HugeGraph-Hubble:HugeGraph-Hubble是HugeGraph的Web可视化管理平台,一站式可视化分析平台。平台覆盖从数据建模,到数据快速导入,再到数据线上线下分析、图统一管理的全流程;
  • HugeGraph-Tools:HugeGraph-Tools 是 HugeGraph 的部署和管理工具,包括管理图形、备份/恢复、Gremlin 执行等功能。
componentsdescription
HugeGraph-ServerHugeGraph的主程序
HugeGraph-Hubble基于Web的可视化图形界面
HugeGraph-Loader数据导入工具
HugeGraph-Tools命令行工具集

本文只选用HugeGraph-Server(0.12.0)和HugeGraph-Hubble(1.6.0)。

2. HugeGraph-server安装配置

2.1、使用安装方法二:下载压缩包(不支持windows)

2.1.1、环境准备

在linux环境中安装jdk1.8和mysql5.7(至少和以上),这个两个的安装和配置网上有很多详细的文章,自行安装即可。

去官网下载HugeGraph-server 0.12.0,并上传至linux opt目录(该目录一般用于软件安装)下备用。

2.1.2、HugeGraph-server安装和配置

进入opt目录

cd /opt

解压之前下载的安装包

tar -xzvf  hugegraph-0.12.0.tar.gz

新建目录

mkdir hugegraph12

移动解压后的文件到新建的目录

mv hugegraph-0.12.0  hugegraph12

进入配置文件目录

cd hugegraph12/hugegraph-0.12.0/conf

进入graphs 这个目录存放hugegraph.properties

cd graphs/

编辑配置文件

vim hugegraph.properties

几个主要的配置文件:

gremlin-server.yaml:Gremlin Server服务配置

rest-server.properties:HugeGraph服务配置

hugegraph.properties:具体图实例的配置,每个图一个配置文件,图的名称就是文件的名称。

下面对需要修改的文件进行详解

2.1.3. 图存储配置

由于各种后端所需的配置(示例图实例配置文件:hugegraph.properties)及启动步骤略有不同,下面只对使用mysql做图数据存储配置及启动做介绍(其它官网文档都有,只有mysql没有)。一个图只有一种存储方式,不同图可以采用不同的后端存储。以下操作红色部分都是修改后hugegraph.properties文件

# auth config: com.baidu.hugegraph.auth.HugeFactoryAuthProxy
gremlin.graph=com.baidu.hugegraph.HugeFactory

# cache config
#schema.cache_capacity=100000
# vertex-cache default is 1000w, 10min expired
vertex.cache_type=l2
#vertex.cache_capacity=10000000
#vertex.cache_expire=600
# edge-cache default is 100w, 10min expired
edge.cache_type=l2
#edge.cache_capacity=1000000
#edge.cache_expire=600


# schema illegal name template
#schema.illegal_name_regex=\s+|~.*

#vertex.default_label=vertex

backend=mysql
serializer=mysql

store=hugegraph

raft.mode=false
raft.safe_read=false
raft.use_snapshot=false
raft.endpoint=127.0.0.1:8281
raft.group_peers=127.0.0.1:8281,127.0.0.1:8282,127.0.0.1:8283
raft.path=./raft-log
raft.use_replicator_pipeline=true
raft.election_timeout=10000
raft.snapshot_interval=3600
raft.backend_threads=48
raft.read_index_threads=8
raft.read_strategy=ReadOnlyLeaseBased
raft.queue_size=16384
raft.queue_publish_timeout=60
raft.apply_batch=1
raft.rpc_threads=80
raft.rpc_connect_timeout=5000
raft.rpc_timeout=60000

search.text_analyzer=jieba
search.text_analyzer_mode=INDEX

# rocksdb backend config
#rocksdb.data_path=/path/to/disk
#rocksdb.wal_path=/path/to/disk

# cassandra backend config
cassandra.host=localhost
cassandra.port=9042
cassandra.username=
cassandra.password=
#cassandra.connect_timeout=5
#cassandra.read_timeout=20
#cassandra.keyspace.strategy=SimpleStrategy
#cassandra.keyspace.replication=3

# hbase backend config
#hbase.hosts=localhost
#hbase.port=2181
#hbase.znode_parent=/hbase
#hbase.threads_max=64

# mysql backend config
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306
jdbc.username=root
jdbc.password=root
jdbc.reconnect_max_times=3
jdbc.reconnect_interval=3
jdbc.sslmode=false

# postgresql & cockroachdb backend config
#jdbc.driver=org.postgresql.Driver
#jdbc.url=jdbc:postgresql://localhost:5432/
#jdbc.username=postgres
#jdbc.password=
#jdbc.postgresql.connect_database=template1

# palo backend config
#palo.host=127.0.0.1
#palo.poll_interval=10
#palo.temp_dir=./palo-data
#palo.file_limit_size=32

修改完后 ESC退出编辑,:wq保存并退出

gremlin-server.yaml 这个文件配置gremlin图数据库查询语言服务配置,网上较多博主说要修改里面的配置,graphs:{},但是修改后启动报错,所以不要修改,默认即可。实践真实有效。

rest-server.properties需要修改,红色部分是修改后的

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

# bind url
restserver.url=http://0.0.0.0:8080
# gremlin server url, need to be consistent with host and port in gremlin-server.yaml
#gremlinserver.url=http://127.0.0.1:8182

#graphs=[hugegraph:conf/hugegraph.properties](网上说修改成这样,但是报错,默认即可
graphs=./conf/graphs


# The maximum thread ratio for batch writing, only take effect if the batch.max_write_threads is 0
batch.max_write_ratio=80
batch.max_write_threads=0

# authentication configs
# choose 'com.baidu.hugegraph.auth.StandardAuthenticator' or 'com.baidu.hugegraph.auth.ConfigAuthenticator'
#auth.authenticator=

# for StandardAuthenticator mode
#auth.graph_store=hugegraph
# auth client config
#auth.remote_url=127.0.0.1:8899,127.0.0.1:8898,127.0.0.1:8897

# for ConfigAuthenticator mode
#auth.admin_token=
#auth.user_tokens=[]

# rpc group configs of multi graph servers
# rpc server configs
rpc.server_host=127.0.0.1
rpc.server_port=8090
#rpc.server_timeout=30

# rpc client configs (like enable to keep cache consistency)
rpc.remote_url=127.0.0.1:8090
#rpc.client_connect_timeout=20
#rpc.client_reconnect_period=10
#rpc.client_read_timeout=40
#rpc.client_retries=3
#rpc.client_load_balancer=consistentHash

# lightweight load balancing (beta)
server.id=server-1
server.role=master

到此所有配置文件都改完了。

2.1.4、启动

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

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

(1)、初次启动

进入目录

cd /opt/hugegraph12/hugegraph-0.12.0

先执行

./bin/init-store.sh

(2)、启动server

./bin/start-hugegraph.sh
Starting HugeGraphServer...
Connecting to HugeGraphServer (http://127.0.0.1:8089/graphs)....OK

测试是否成功

访问http://服务器ip:8080/graphs

结果:

{  "graphs": [ "hugegraph" ]}

2.1、使用安装方法三:源码编译

2.1.1 拉取代码并修改配置

进入idea git clone :https://github.com/apache/incubator-hugegraph.git

把12 版本的代码拉下来,目录结构如下图:

找到我们需要修改的配置文件如图:

 hugegraph.properties 的修改和在linux安装配置的修改内容一样

gremlin-server.yaml 修改 

由于win的路径问题,默认配置files: [conf/empty-sample.groovy]会找不到empty-sample.groovy这个文件,这里有两种解决办法
1、将files: [conf/empty-sample.groovy]注释掉  (使用这个方式即可)
2、将empty-sample.groovy文件copy到/下,并修改file为files: [empty-sample.groovy]

如图:

 rest-server.properties 修改,如图:

 

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

  2.1.3、启动服务

 

 运行,无报错即成功,测试方式和之前一样。

以此启动的服务作为本地服务器,仅供学习或本地开发使用,若作为公司服务则不推荐该方法

3. HugeGraph-Hubble 安装配置和使用

至此HugeGraph-server的安装配置都已讲完。

HugeGraph-Hubble的安装配置请看下一篇文章,HugeGraph-Hubble安装配置和简单使用

  • 1
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值