开发与测试¶
本文档介绍如何从源代码构建和测试GraphScope交互式引擎。
开发环境¶
这里我们将使用一个预构建的Docker镜像,其中已安装所有必要的依赖项。
docker run --name dev -it --shm-size=4096m registry.cn-hongkong.aliyuncs.com/graphscope/graphscope-dev:latest
请参考Dev Environment获取更多开发环境配置选项。
在本地使用Vineyard存储构建GIE¶
在GIE独立部署中,我们已经介绍了如何在带有Vineyard存储的Kubernetes集群中部署GIE。这里,我们将展示如何在本地机器上使用vineyard存储开发和测试GIE。
如果您尚未获取,请克隆 `graphscope` 代码库。
git clone https://github.com/alibaba/graphscope
cd graphscope
现在您已准备好通过以下命令构建GIE引擎(基于vineyard存储):
python3 gsctl.py make interactive --storage-type=vineyard
您可以在interactive_engine/assembly/target/graphscope中找到构建产物。
您可以通过以下方式将其安装到指定位置
python3 gsctl.py make interactive-install --storage-type=vineyard --install-prefix /opt/graphscope
在本地使用Vineyard存储测试GIE¶
您可以通过以下命令在vineyard存储上测试GIE引擎:
python3 gsctl.py test interactive --local --storage-type=vineyard
这将运行端到端测试,从编译Gremlin查询到从计算引擎获取并验证结果。测试内容包括:
Tinkerpop的gremlin测试: 我们复现了Tinkerpop官方的测试套件,该套件主要基于Tinkerpop的modern图数据集。
IR pattern test: 除了Tinkerpop官方对
match步骤的测试外,我们还提供了针对modern图的额外模式查询。LDBC测试: 我们在LDBC社交网络上使用比例因子(sf)1对GIE进行了LDBC复杂工作负载的进一步测试。更多详情请参阅教程。
手动启动GIE服务¶
GIE服务的最小集合包括一个用于发送Gremlin查询的前端,以及一个(带有vineyard的)执行器来执行这些查询。后续说明概述了分别启动前端和执行器的过程,以便更深入地探索引擎。
首先,确保vineyard服务已在运行且图数据已成功加载。当图数据成功加载到vineyard后,您将获得一个
用于访问图数据。
提示
如果您不确定如何初始化vineyard存储,以下说明可以帮助您创建一个支持modern graph的vineyard存储。
export VINEYARD_IPC_SOCKET=/tmp/vineyard.sock
vineyardd --socket=${VINEYARD_IPC_SOCKET} --meta=local &
# load modern graph
export STORE_DATA_PATH=charts/gie-standalone/data # relative to graphscope repo
vineyard-graph-loader --config charts/gie-standalone/config/v6d_modern_loader.json
设置环境变量
GIE_TEST_HOME:
export GIE_TEST_HOME=interactive_engine/assembly/target/graphscope
配置
$GIE_TEST_HOME/conf/executor.vineyard.properties文件:
graph.name = GRAPH_NAME
# RPC port that executor will listen on
rpc.port = 1234
# Server ID
server.id = 0
# Total server size
server.size = 1
# ip:port separated by ','
# e.g., 1.2.3.4:1234,1.2.3.5:1234
network.servers = 127.0.0.1:11234
# This worker refers to the number of threads
pegasus.worker.num = 1
graph.type = VINEYARD
# Please replace with the actual object ID of your graph
graph.vineyard.object.id: <v6d_object_id>
启动
gaia_executor:
$GIE_TEST_HOME/bin/gaia_executor $GIE_TEST_HOME/conf/log4rs.yml $GIE_TEST_HOME/conf/executor.vineyard.properties &
配置
$GIE_TEST_HOME/conf/frontend.vineyard.properties文件:
## Pegasus service config
# a.k.a. thread num
pegasus.worker.num = 1
pegasus.batch.size = 1024
pegasus.output.capacity = 16
# executor config
# ip:port separated by ','
# e.g., 1.2.3.4:1234,1.2.3.5:1234
pegasus.hosts = localhost:1234
# graph schema path
graph.schema = /tmp/<v6d_object_id>.json
## Gremlin Server Port
gremlin.server.port = 8182
## Bolt Server Port
neo4j.bolt.server.port = 7687
# disable authentication if username or password is not set
# auth.username = default
# auth.password = default
# set total execution time for a query
query.execution.timeout.ms: 3000000
启动
frontend:
java -cp ".:$GIE_TEST_HOME/lib/*" -Djna.library.path=$GIE_TEST_HOME/lib com.alibaba.graphscope.frontend.Frontend $GIE_TEST_HOME/conf/frontend.vineyard.properties &
通过前端服务,您可以打开gremlin控制台并将端点设置为
localhost:8182,如此处所示。同样地,您可以使用-a选项打开cypher-shell并将url设置为neo4j://localhost:7687,如此处所示。
终止
vineyardd、gaia_executor和frontend服务:
pkill -f vineyardd
pkill -f gaia_executor
pkill -f Frontend