nebula 版本:2.0.0beta
部署方式(分布式 / 单机 / Docker / DBaaS):docker
硬件信息
磁盘( 必须为 SSD ,不支持 HDD)500G SSD
CPU、内存信息:128G 40c
问题的具体描述
nebula2-python 和nebula-python版本变化较大,之前看到文章有使用nebula-python查询全部点和边的方法,想问问在nebula2-python中如何查询,如何调用类似的scan_edge和scan_vertex
nebula-python中的查询代码
meta_client = MetaClient([('192.168.xxx.xxx', 45500)])
meta_client.connect()
storage_client = StorageClient(meta_client)
scan_edge_processor = ScanEdgeProcessor(meta_client)
scan_edge_response_iterator = storage_client.scan_edge(space_name, return_cols, all_cols, limit, start_time, end_time)
while scan_edge_response_iterator.has_next():
scan_edge_response = scan_edge_response_iterator.next()
if scan_edge_response is None:
print("Error occurs while scaning edge")
break
result = scan_edge_processor.process(space_name, scan_edge_response)
for edge_name, edge_rows in result.rows.items():
...
...
也是说在2.0中,如何通过python客户端来遍历边和点呢,有没有相应的参考样例?
简而言之,就是:
在nebula2-python中如何查询全部的点和边以及他们的属性
nebula2-python的storage client的scan功能的pr还没merge,你可以关注下这个pr
vesoft-inc:master
← laura-ding:meta_client
opened 02:22AM - 07 Dec 20 UTC
1 个赞
具体啥时候merge有计划吗?需要用这个工具做些测试
发现这个pull request已经merge了,但是我把master分支clone下来然后安装之后,执行scan的方法时候会报一下错误:
nebula2\meta\MetaService.py", line 16815, in recv_listSpaces
raise x
thrift.Thrift.TApplicationException: Method name listSpaces not found
是不是还有其他代码需要合并才能正常使用scan的功能?
1 个赞
你是连错服务了吧,你是不是连到storage到ip和端口去了,示例的metacache连的服务的ip和端口是metad的。我等下加上文档,示例代码没有任何注释,非常抱歉。
好像就是端口搞错了,那请问一下,我创建meta client的时候应该指定哪个端口:
我的docker的启动是按照上面的compose来的。
henson
2020 年12 月 29 日 09:32
11
docker 启动的应该还会有连不上的情况(网络不通),等你的下一个回复
首先你的docker-compose文件需要更新下image的名字,现在改为v2-nightly,你要用最新的版本,不然接口不对应的,metad的没有映射端口出来,你需要用它动态的端口。首先你需要确定你运行的服务能不能访问你docker的网络,不能的话,你需要把docker网络模式配置成host模式,不然你需要去容器里面运行程序才能正常运行
henson
2020 年12 月 29 日 09:36
13
就是丁丁大佬说的这个了,期待能从nebula方面能解决这个
@jude-zhu 再次艾特jude
我看了一下netstat的端口状态,宿主机当前是35931和35932这两个端口,而不是45500和45501。
所以我试了一下,meta_client连45500是连不上的;
连35931和35932可以连上,但是执行scan的时候报错了:
nebula2\mclient_init _.py", line 321, in get_part_leaders
raise SpaceNotFoundException(space_name)
nebula2.Exception.SpaceNotFoundException:
感觉是连接没有获取到nebula的元信息数据。
henson
2020 年12 月 29 日 09:39
16
mac上不通的话,用这个解决 @zealot-shin
你确认下你scan的space name是否存在,这里告诉你scan的space不存在
存在的。
我运行代码是在windows环境下的pycharm里面跑的。
nebula是部署在另一个服务器,用docker启动的。
我是不是可以先telnet一下nebula服务器的meta 、storage的ip和44500、45500端口?
1 个赞
你有打印“Update meta data failed”吗?连不上是会抛异常的,你都没有抛异常,说明是正常连上的
打印了:
Update meta data failed: TSocket read 0 bytes
[2020-12-29 17:35:11,347]:Traceback (most recent call last):
File “venv\lib\site-packages\nebula2_python-2.0.0.post1-py3.8.egg\nebula2\mclient_init _.py”, line 191, in _load_all
spaces = self._meta_client.list_spaces()