hugegraph-部署文档

fansichao 2021-10-23 16:25:17
Categories: > Tags:

安装部署

HugeGragh 共有如下工具

HugeGragh 框架模块

总结: 部署 HugeGraph 需要 HugeGraph-Server,在网页上操作图需要 HugeGraph-Studio。

需要安装 HugeGraph-Server HugeGraph-Studio HugeGraph-Loader 下载解压即用,详情见HugeGraph 官网

安装部署命令

1
2
3
4
5
6
# 默认CentOS会自带这些包,Docker中的镜像需要自行安装

# 解决问题 line 92: crontab: command not found
yum -y install lsof crontabs

# 解压即用,安装包详见 Packages/hugegraph 下

配置文件详解

hugegraph.properties

cat conf/hugegraph.properties

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# gremlin entrence to create graph
gremlin.graph=com.baidu.hugegraph.HugeFactory

# cache config
#schema.cache_capacity=1048576
#graph.cache_capacity=10485760
#graph.cache_expire=600

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

#vertex.default_label=vertex

# 使用 rocksdb 方式,配置目录 rocksdb_data & rocksdb_wal, 需要自建
backend=rocksdb
serializer=binary
rocksdb.data_path=/data/hugegraph/rocksdb_data
rocksdb.wal_path=/data/hugegraph/rocksdb_wal

#backend=scylladb
#serializer=scylladb

# Memory 临时存储在内存中,重启服务器后数据消失
# backend=memory
# serializer=text

# 设置存储库名称
store=hugegraph

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


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


# mysql backend config
#jdbc.url=jdbc:mysql://127.0.0.1:3306
#jdbc.username=root
#jdbc.password=
#jdbc.reconnect_max_times=3
#jdbc.reconnect_interval=3


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

rest-server.properties

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
cat conf/rest-server.properties
# bind url
# 配置为 0.0.0.0 使得其他机器可以访问

#restserver.url=http://127.0.0.1:8080
restserver.url=http://0.0.0.0:8080

# 设置 图库对应使用的配置文件
# graphs list with pair NAME:CONF_PATH
graphs=[hugegraph:conf/hugegraph.properties]

# authentication
#auth.require_authentication=
#auth.admin_token=
#auth.user_tokens=[]

gremlin-server

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
cat conf/gremlin-server.yaml

scriptEvaluationTimeout: 30000
# If you want to start gremlin-server for gremlin-console(web-socket),
# please change `HttpChannelizer` to `WebSocketChannelizer` or comment this line.
channelizer: org.apache.tinkerpop.gremlin.server.channel.HttpChannelizer
graphs: {
# 库名称 & 库配置文件
hugegraph: conf/hugegraph.properties
}
plugins:
- com.baidu.hugegraph
scriptEngines: {
gremlin-groovy: {
imports: [java.lang.Math],
staticImports: [java.lang.Math.PI],
scripts: [scripts/empty-sample.groovy]
}
}
serializers:
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoLiteMessageSerializerV1d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GryoMessageSerializerV1d0,
config: {
serializeResultToString: true,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV1d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerGremlinV2d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
- { className: org.apache.tinkerpop.gremlin.driver.ser.GraphSONMessageSerializerV1d0,
config: {
serializeResultToString: false,
ioRegistries: [com.baidu.hugegraph.io.HugeGraphIoRegistry]
}
}
metrics: {
consoleReporter: {enabled: false, interval: 180000},
csvReporter: {enabled: true, interval: 180000, fileName: /tmp/gremlin-server-metrics.csv},
jmxReporter: {enabled: false},
slf4jReporter: {enabled: false, interval: 180000},
gangliaReporter: {enabled: false, interval: 180000, addressingMode: MULTICAST},
graphiteReporter: {enabled: false, interval: 180000}
}
maxInitialLineLength: 4096
maxHeaderSize: 8192
maxChunkSize: 8192
maxContentLength: 65536
maxAccumulationBufferComponents: 1024
resultIterationBatchSize: 64
writeBufferLowWaterMark: 32768
writeBufferHighWaterMark: 65536
ssl: {
enabled: false
}

配置 HugeGraph 连接数据库

修改配置文件

第一次使用 HugeGraph 时,需要初始化数据库

bin/init-store.sh

初始化数据库时,必须先 bin/stop-hugegraph.sh ,否则可能初始化失败。

启动服务

bin/start-hugegraph.sh

启动服务时,必须先关闭 hugegraph-studio 服务。否则会启动失败,报错端口已被使用。

查看浏览器页面