Hugegrap集群部署之Rocksdb存储
服务器信息
服务器ip | Role | 配置信息 |
---|---|---|
192.168.230.128 | master | 32c64G1000G |
192.168.230.129 | worker | 32C64G1000G |
192.168.230.130 | worker | 32C64G1000G |
下载安装包
这里推荐使用1.5.0版本,途中踩了很多坑研究了很长时间,参考
https://github.com/apache/incubator-hugegraph/issues/2787
# 服务包
https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.5.0/apache-hugegraph-incubating-1.5.0.tar.gz?action=download
# 工具包
https://www.apache.org/dyn/closer.lua/incubator/hugegraph/1.5.0/apache-hugegraph-toolchain-incubating-1.5.0.tar.gz?action=download
开始部署Hugegraph
tar xf apache-hugegraph-incubating-1.5.0.tar.gz -C /home/hugegraph
cd /home/hugegraph/apache-hugegraph-server-incubating-1.5.0/conf
# 192.168.230.128 修改配置文件如下
[root@localhost conf]# cat rest-server.properties
# 允许所有ip访问
restserver.url=http://0.0.0.0:8080
graphs=./conf/graphs
batch.max_write_ratio=80
batch.max_write_threads=0
arthas.telnet_port=8562
arthas.http_port=8561
arthas.ip=127.0.0.1
arthas.disabled_commands=jad
# 是否开启鉴权
auth.authenticator=org.apache.hugegraph.auth.StandardAuthenticator
auth.graph_store=hugegraph
# 本机ip
rpc.server_host=192.168.230.128
rpc.server_port=8091
rpc.server_timeout=30
# 集群ip信息
rpc.remote_url=192.168.230.128:8091,192.168.230.129:8092,192.168.230.130:8093
#rpc.client_connect_timeout=20
#rpc.client_reconnect_period=10
#rpc.client_read_timeout=40
#rpc.client_retries=3
#rpc.client_load_balancer=consistentHash
# id不可重复
server.id=server-1
server.role=master
# slow query log
log.slow_query_threshold=1000
# jvm(in-heap) memory usage monitor, set 1 to disable it
memory_monitor.threshold=0.85
memory_monitor.period=2000
# 192.168.230.128 修改配置文件如下
[root@localhost conf]# vim graphs/hugegraph.properties
gremlin.graph=org.apache.hugegraph.HugeFactory
vertex.cache_type=l2
edge.cache_type=l2
backend=rocksdb
serializer=binary
store=hugegraph
task.scheduler_type=local
task.schedule_period=10
task.retry=0
task.wait_timeout=10
search.text_analyzer=jieba
search.text_analyzer_mode=INDEX
rocksdb.data_path=./data
rocksdb.wal_path=./wal
raft.mode=true
raft.group_peers=192.168.230.128:8091,192.168.230.129:8092,192.168.230.130:8093
# 参数优化。具体看官网介绍,这个是字节单位不可写MB GB单位否则报错
# 我这是参考官方的64G的优化 也可不写
rocksdb.write_buffer_size=134217728
rocksdb.max_write_buffer_number=6
rocksdb.block_cache_size=8589934592
# 发送到129 和 130 服务器
# 128服务器执行
cd /home
scp -r hugegraph/ root@192.168.230.129:/home
# 输入服务器密码发送
# 129服务器修改 rest-server.properties
rpc.server_host=192.168.230.129
rpc.server_port=8092
server.id=server-2
server.role=worker
# 130服务器修改 rest-server.properties
rpc.server_host=192.168.230.130
rpc.server_port=8093
server.id=server-3
server.role=worker
# 初始化rocksdb 三台设备都需要操作
cd /home/hugegraph/apache-hugegraph-server-incubating-1.5.0/bin
./init-store.sh
# 输入密码。 访问Hugegraph时需要使用 三台都要输入
# 三台都要操作,启动服务
[root@localhost bin]# ./start-hugegraph.sh
Starting HugeGraphServer in daemon mode...
Connecting to HugeGraphServer (http://0.0.0.0:8080/graphs)...............
The operation timed out(30s) when attempting to connect to http://0.0.0.0:8080/graphs
See /home/apache-hugegraph-incubating-1.5.0/apache-hugegraph-server-incubating-1.5.0/logs/hugegraph-server.log for HugeGraphServer log output.
# 可能会报错,稍等一会就好
验证集群状态
[root@localhost conf]# curl -X GET "http://192.168.230.128:8080/graphs/hugegraph/raft/list_peers" -u admin:创建时的密码 |jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 84 100 84 0 0 8581 0 --:--:-- --:--:-- --:--:-- 9333
{
"hugegraph": [
"192.168.230.128:8091",
"192.168.230.129:8092",
"192.168.230.130:8093"
]
}
[root@localhost conf]# curl -X GET "http://192.168.230.128:8080/graphs/hugegraph/raft/get_leader" -u admin:123456 |jq
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 36 100 36 0 0 3610 0 --:--:-- --:--:-- --:--:-- 3600
{
"hugegraph": "192.168.230.128:8091"
}
常用接口如下:
查询 Raft 集群所有节点(peers):
GET http://<host>:<port>/graphs/<graph>/raft/list_peers
查询当前 leader 节点:
GET http://<host>:<port>/graphs/<graph>/raft/get_leader
查询系统健康指标:
GET http://<host>:<port>/metrics/system
查询后端存储健康指标:
GET http://<host>:<port>/metrics/backend
curl -X GET "http://192.168.230.128:8080/graphs/hugegraph/raft/list_peers" -u admin:密码"
部署web可视化工具
# 三台设备随便一个设备部署即可
tar xf apache-hugegraph-toolchain-incubating-1.5.0.tar.gz -C /home
cd /home/apache-hugegraph-toolchain-incubating-1.5.0/apache-hugegraph-hubble-incubating-1.5.0/bin
./start-hubble.sh
访问web
部署hubel的机器ip:8088
创建图 创建顶点和边测试