使用storage_client导出数据,报错显示Get storage address from meta cache is empty

使用storage_client导出数据,报错显示Get storage address from meta cache is empty
show hosts; show hosts meta; show hosts graph; 查看服务一切正常

socket error connecting to host metad1, port 9559 (None): gaierror(-2, 'Name or service not known')
Update meta data failed: Transport not open
Traceback (most recent call last):
  File "/usr/local/python3/lib/python3.8/site-packages/nebula3/mclient/__init__.py", line 305, in _load_all
    spaces = self._meta_client.list_spaces()
  File "/usr/local/python3/lib/python3.8/site-packages/nebula3/mclient/__init__.py", line 142, in list_spaces
    resp = self._connection.listSpaces(req)
  File "/usr/local/python3/lib/python3.8/site-packages/nebula3/meta/MetaService.py", line 17615, in listSpaces
    self.send_listSpaces(req)
  File "/usr/local/python3/lib/python3.8/site-packages/nebula3/meta/MetaService.py", line 17624, in send_listSpaces
    self._oprot.trans.flush()
  File "/usr/local/python3/lib/python3.8/site-packages/nebula3/fbthrift/transport/TTransport.py", line 193, in flush
    self.__trans.write(out)
  File "/usr/local/python3/lib/python3.8/site-packages/nebula3/fbthrift/transport/TSocket.py", line 318, in write
    raise TTransportException(TTransportException.NOT_OPEN,
nebula3.fbthrift.transport.TTransport.TTransportException: Transport not open

Get storage address from meta cache is empty

代码如下

from nebula3.mclient import MetaCache
from nebula3.sclient.GraphStorageClient import GraphStorageClient


def transfer_tag_data(data, tag):
    return


def scan_tag_with_name(graph_storage_client, tag):
    with open(f"tag.csv", 'w') as f:
        resp = graph_storage_client.scan_vertex(space_name='frfr', tag_name=tag, limit=1000)
        print('======== Scan vertexes in frfr ======')
        while resp.has_next():
            result = resp.next()
            ls = []
            for vertex_data in result:
                ls.append(transfer_tag_data(vertex_data, tag))
                f.writelines(ls)


def scan_edge_with_name(graph_storage_client, edge):
    resp = graph_storage_client.scan_edge(
        space_name='ScanSpace', edge_name=edge, limit=100
    )
    print('======== Scan edges in ScanSpace ======')
    while resp.has_next():
        result = resp.next()
        for edge_data in result:
            print(edge_data)


if __name__ == '__main__':
    meta_cache = None
    graph_storage_client = None
    try:
        # the metad servers's address
        meta_cache = MetaCache(
            [('10.48.106.149', 9559), ('10.48.106.149', 9560), ('10.48.106.149', 9561)], 50000
        )
        graph_storage_client = GraphStorageClient(meta_cache)
        scan_tag_with_name(graph_storage_client, tag="frame")
    except Exception as e:
        print(e)
    finally:
        if graph_storage_client is not None:
            graph_storage_client.close()
        if meta_cache is not None:
            meta_cache.close()

nebula graph服务采用docker-compose部署,获取的meta地址被转换成 (‘metad1’, 9559)

用的版本是多少?

nebula版本3.2.0,nebula3-python版本3.1.0和3.3.0都试过
while resp.has_next(): result = resp.next()
现在不报Get storage address from meta cache is empty了,但是在循环这里会卡住

用pstack看一下client和storage分别卡在了什么地方

just in case 插一句, python storageclient code run time 可以访问、解析 meta/storage 的地址对吧?

能够解析,因为是用docker-compose部署的,所以解析出来是metad0/metad1这样的

1 个赞