Star

nebula2-python 获取客户端连接时报错:TSocket read 0 bytes

  • nebula 版本:2.0.0beta
  • nebula-python版本: 2.0.0.post1
  • 部署方式(分布式 / 单机 / Docker / DBaaS):docker
  • 硬件信息
    • 磁盘( 必须为 SSD ,不支持 HDD)500GB SSD
    • CPU、内存信息:128G 40C
  • 问题的具体描述
    按照nebula-python的官方说明,进行连接池的初始化,执行到验证用户名和密码那一步时报错:
Traceback (most recent call last):
  File "D:\projects\nebula_networkX\venv\lib\site-packages\nebula2\gclient\net\__init__.py", line 349, in authenticate
    resp = self._connection.authenticate(user_name, password)
  File "D:\projects\nebula_networkX\venv\lib\site-packages\nebula2\graph\GraphService.py", line 892, in authenticate
    return self.recv_authenticate()
  File "D:\projects\nebula_networkX\venv\lib\site-packages\nebula2\graph\GraphService.py", line 904, in recv_authenticate
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
  File "D:\projects\nebula_networkX\venv\lib\site-packages\thrift\protocol\TBinaryProtocol.py", line 153, in readMessageBegin
    name = self.trans.readAll(sz)
  File "D:\projects\nebula_networkX\venv\lib\site-packages\thrift\transport\TTransport.py", line 75, in readAll
    chunk = self.read(need)
  File "D:\projects\nebula_networkX\venv\lib\site-packages\thrift\transport\TTransport.py", line 186, in read
    self.__rbuf = StringIO(self.__trans.read(max(sz, self.__rbuf_size)))
  File "D:\projects\nebula_networkX\venv\lib\site-packages\thrift\transport\TSocket.py", line 300, in read
    raise TTransportException(type=TTransportException.END_OF_FILE,
thrift.transport.TTransport.TTransportException: TSocket read 0 bytes

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Program Files\JetBrains\PyCharm Community Edition 2018.1.3\helpers\pydev\pydevd.py", line 1664, in <module>
    main()
  File "D:\Program Files\JetBrains\PyCharm Community Edition 2018.1.3\helpers\pydev\pydevd.py", line 1658, in main
    globals = debugger.run(setup['file'], None, None, is_module)
  File "D:\Program Files\JetBrains\PyCharm Community Edition 2018.1.3\helpers\pydev\pydevd.py", line 1068, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "D:\Program Files\JetBrains\PyCharm Community Edition 2018.1.3\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "D:/projects/nebula_networkX/main/main.py", line 111, in <module>
    session = connection_pool.get_session('root', 'password')
  File "D:\projects\nebula_networkX\venv\lib\site-packages\nebula2\gclient\net\__init__.py", line 178, in get_session
    session_id = connection.authenticate(user_name, password)
  File "D:\projects\nebula_networkX\venv\lib\site-packages\nebula2\gclient\net\__init__.py", line 356, in authenticate
    raise IOErrorException(IOErrorException.E_CONNECT_BROKEN, te.message)
nebula2.Exception.IOErrorException: TSocket read 0 bytes

报错代码和官网提供的例子基本一致


    # define a config
    config = Config()
    config.max_connection_pool_size = 10
    # init connection pool
    connection_pool = ConnectionPool()
    # if the given servers are ok, return true, else return false
    ok = connection_pool.init([('192.168.xxx.xxx', 7001)], config)

    # get session from the pool
    session = connection_pool.get_session('root', 'password')

    # show hosts
    result = session.execute('SHOW HOSTS')
    print(result)

    # release session
    session.release()

    # close the pool
    connection_pool.close()

报错语句:session = connection_pool.get_session('root', 'password')

检查一下服务端口是不是一致

果然是端口号搞错了。。。。

上面写的web界面的端口。。。。

不好意思,乌龙

1赞

浙ICP备20010487号