nebula-python连接被接连拒接

  • nebula 版本:2.0.0
  • nebula-python 版本:2.0.0

  • 部署方式: 单机
  • 安装方式:源码编译
  • 问题的具体描述
    使用nebula-python连接storage,python代码如下:
import sys

sys.path.insert(0, '../')

from nebula2.mclient import MetaCache
from nebula2.sclient.GraphStorageClient import GraphStorageClient
# 设置所有 Meta 服务地址
meta_cache = MetaCache([('172.26.209.114', 9559)],50000)
graph_storage_client = GraphStorageClient(meta_cache)

resp = graph_storage_client.scan_vertex(
        space_name='basketballplayer',
        tag_name='player')
while resp.has_next():
    result = resp.next()
    for vertex_data in result:
        print(vertex_data)

resp = graph_storage_client.scan_edge(
    space_name='basketballplayer',
    edge_name='follow')
while resp.has_next():
    result = resp.next()
    for edge_data in result:
        print(edge_data)

运行报错:

ERROR:root:Create storage connection failed: socket error connecting to host 127.0.0.1, port 9779 (('127.0.0.1', 9779)): ConnectionRefusedError(10061, '由于目标计算机积极拒绝,无法连接。', None, 10061, None)
Traceback (most recent call last):
  File "C:\Users\19082\AppData\Roaming\Python\Python39\site-packages\nebula2\fbthrift\transport\TSocket.py", line 286, in open
    handle.connect(address)
ConnectionRefusedError: [WinError 10061] 由于目标计算机积极拒绝,无法连接。

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\19082\Desktop\nebula_storage\storage.py", line 9, in <module>
    graph_storage_client = GraphStorageClient(meta_cache)
  File "C:\Users\19082\AppData\Roaming\Python\Python39\site-packages\nebula2\sclient\GraphStorageClient.py", line 41, in __init__
    self._create_connection()
  File "C:\Users\19082\AppData\Roaming\Python\Python39\site-packages\nebula2\sclient\GraphStorageClient.py", line 76, in _create_connection
    conn.open()
  File "C:\Users\19082\AppData\Roaming\Python\Python39\site-packages\nebula2\sclient\net\__init__.py", line 41, in open
    transport.open()
  File "C:\Users\19082\AppData\Roaming\Python\Python39\site-packages\nebula2\fbthrift\transport\TTransport.py", line 173, in open
    return self.__trans.open()
  File "C:\Users\19082\AppData\Roaming\Python\Python39\site-packages\nebula2\fbthrift\transport\TSocket.py", line 301, in open
    raise TTransportException(TTransportException.NOT_OPEN, msg)
nebula2.fbthrift.transport.TTransport.TTransportException: socket error connecting to host 127.0.0.1, port 9779 (('127.0.0.1', 9779)): ConnectionRefusedError(10061, '由于目标计算机积极拒绝,无法连接。', None, 10061, None)

Process finished with exit code 1

查看nebula运行正常

[syy@localhost ~]$ /usr/local/nebula/scripts/nebula.service status all
[WARN] The maximum files allowed to open might be too few: 1024
[INFO] nebula-metad: Running as 24262, Listening on 9559 
[INFO] nebula-graphd: Running as 24363, Listening on 9669 
[INFO] nebula-storaged: Running as 24457, Listening on 9779 

防火墙已关闭

因为 storage conf 里边配置的地址是 127.0.0.1 9779,python client 运行的地方无法通过这个 loopback 地址访达 storageD,需要改 storage D 的listen 地址为 client 可以访问才行

可以尝试:

  1. 把 meta 配置里的 storage 地址改成真实ip
  2. 在客户端手动指定 storage 地址, 不从 meta cache 中获取
2 个赞

此话题已在最后回复的 7 天后被自动关闭。不再允许新回复。