HugeGraphServer、Hubble的安装
一、安装包准备
1、下载地址:https://github.com/hugegraph/hugegraph/releases/download/v0.11.2/hugegraph-0.11.2.tar.gz
2、将下载好的安装包上传至/opt/soft
二、安装HugeGraphServer
1、解压hugegraph-0.11.2.tar.gz
(1)创建hugegraph文件夹
mkdir -p /opt/module/hugegraph
(2)解压hugegraph-0.11.2.tar.gz
tar -zxvf /opt/soft/hugegraph-0.11.2.tar.gz -C /opt/module/hugegraph
(3)复制一份解压后的文件夹(个人习惯,可忽略)
cp -r /opt/module/hugegraph/hugegraph-0.11.2/ /opt/module/hugegraph/hugegraph-0.11.2-meta/
2、修改配置
(1)computer.yaml
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/computer.yaml
将如下内容:
hugegraph_url: "http://127.0.0.1:8080",
hugegraph_name: hugegraph,
改为:
hugegraph_url: "http://192.168.xxx.100:8084",
hugegraph_name: hugegraph_aa,
(2)gremlin-driver-settings.yaml
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/gremlin-driver-settings.yaml
将如下内容:
hosts: [localhost]
port: 8182
改为:
hosts: [192.168.xxx.100]
port: 8184
(3)gremlin-server.yaml
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/gremlin-server.yaml
将如下内容:
scriptEvaluationTimeout: 30000 graphs: { hugegraph: conf/hugegraph.properties }
改为:
scriptEvaluationTimeout: 120000 graphs: { hugegraph_aa: conf/hugegraph.properties }
(4)hugegraph.properties
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/hugegraph.properties
修改如下内容:
backend=hbase serializer=hbase store=hbase_hugegraph
注释如下内容:
#cassandra.host=localhost #cassandra.port=9042 #cassandra.username= #cassandra.password=
添加如下内容:
hbase.hosts=192.168.xxx.100,192.168.xxx.101,192.168.xxx.102 hbase.port=2181 hbase.znode_parent=/hbase hbase.threads_max=256
(5)remote-objects.yaml
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/remote-objects.yaml
将如下内容:
hosts: [localhost]
port: 8182
修改为:
hosts: [192.168.xxx.100]
port: 8184
(6)remote.yaml
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/remote.yaml
将如下内容:
hosts: [localhost]
port: 8182
修改为:
hosts: [192.168.xxx.100]
port: 8184
(7)rest-server.properties
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/rest-server.properties
修改如下内容:
restserver.url=http://192.168.xxx.100:8084 graphs=[hugegraph_aa:conf/hugegraph.properties] server.id=server-100
添加如下内容:
#休息服务器的最大工作线程数 restserver.max_worker_threads=2 #rest server 的最小可用内存(MB),当系统可用内存低于此值时,请求将被拒绝 restserver.min_free_memory=20480 #请求必须完成的时间(以秒为单位),-1 表示没有超时 restserver.request_timeout=180 #保持非活动连接处于活动状态的时间(以秒为单位),-1 表示没有超时 restserver.connection_idle_timeout=600 #一个keep-alive连接允许处理的最大HTTP请求数,-1表示无限制 restserver.connection_max_requests=1000 #gremlin 服务器的最大路由数 gremlinserver.max_route=30 #等待 gremlin 服务器的超时时间(以秒为单位) gremlinserver.timeout=180 #每批提交的最大边数 batch.max_edges_per_batch=2000 #每批提交的最大顶点数 batch.max_vertices_per_batch=2000
三、初始化HugeGraph
1、执行初始化脚本init-store.sh
/opt/module/hugegraph/hugegraph-0.11.2-meta/bin/init-store.sh
2、执行过程中,会让你设置admin用户的密码,完成之后按回车即可。
四、HugeGraphServer启停
/opt/module/hugegraph/hugegraph-0.11.2-meta/bin/start-hugegraph.sh -s false
/opt/module/hugegraph/hugegraph-0.11.2-meta/bin/stop-hugegraph.sh
五、细粒度权限认证
1、StandardAuthenticator模式
StandardAuthenticator模式是通过在数据库后端存储用户信息来支持用户认证和权限控制,该实现基于数据库存储的用户的名称与密码进行认证(密码已被加密),基于用户的角色来细粒度控制用户权限。下面是具体的配置流程(重启服务生效)
(1)gremlin-server.yaml
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/gremlin-server.yaml
添加如下内容,配置authenticator及其rest-server文件路径
authentication: { authenticator: com.baidu.hugegraph.auth.StandardAuthenticator, authenticationHandler: com.baidu.hugegraph.auth.WsAndHttpBasicAuthHandler, config: {tokens: conf/rest-server.properties} }
(2)rest-server.properties
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/rest-server.properties
添加如下内容,配置authenticator及其graph_store信息
auth.authenticator=com.baidu.hugegraph.auth.StandardAuthenticator
auth.graph_store=hugegraph_aa
(3)hugegraph.properties
vim /opt/module/hugegraph/hugegraph-0.11.2-meta/conf/hugegraph.properties
修改如下内容,配置gremlin.graph信息
gremlin.graph=com.baidu.hugegraph.auth.HugeFactoryAuthProxy
2、创建用户分配权限资源
参考文档:https://hugegraph.apache.org/docs/clients/restful-api/auth/#params
六、HugeGraph-Hubble安装
1、安装包下载
(1)下载地址:https://github.com/hugegraph/hugegraph-hubble/releases/download/v1.5.0/hugegraph-hubble-1.5.0.tar.gz
(2)下载完成后上传至/opt/soft目录
2、解压
tar -zxvf /opt/soft/hugegraph-hubble-1.5.0.tar.gz -C /opt/module/hugegraph/
3、修改配置
vim /opt/module/hugegraph/hugegraph-hubble-1.5.0/conf/hugegraph-hubble.properties
修改如下内容:
server.host=192.168.xxx.100 server.port=8088 gremlin.suffix_limit=500 gremlin.vertex_degree_limit=500 gremlin.edges_total_limit=500 gremlin.batch_query_ids=200
4、配置环境变量
vim /etc/profile
添加如下内容:
#HUBBLE_HOME export HUBBLE_HOME=/opt/module/hugegraph/hugegraph-hubble-1.5.0 export PATH=$PATH:$HUBBLE_HOME/bin
完成之后刷新配置
source /etc/profile
4、启停Hubble
start-hubble.sh
stop-hubble.sh
5、访问Web页面
地址:http://192.168.xxx.100:8088/