nebula-python icon indicating copy to clipboard operation
nebula-python copied to clipboard

connction

Open SerenNoble opened this issue 9 months ago • 1 comments

from nebula3.gclient.net import ConnectionPool from nebula3.Config import Config

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([('127.0.0.1', 9669)], config)

option 1 control the connection release yourself

get session from the pool

session = connection_pool.get_session('root', 'nebula')

select space

session.execute('USE basketballplayer')

show tags

result = session.execute('SHOW TAGS') print(result)

release session

session.release()

option 2 with session_context, session will be released automatically

with connection_pool.session_context('root', 'nebula') as session: session.execute('USE basketballplayer') result = session.execute('SHOW TAGS') print(result)

close the pool

connection_pool.close() 在使用官方案例时会报错 Connect 10.113.36.125:9669 failed: Socket read failed: [Errno 104] Connection reset by peer Traceback (most recent call last): File "/home/chatgpt/m31660/Pycharm/nebula/insert_gcov_data.py", line 148, in nebula_pool = create_nebula_root_client() File "/home/chatgpt/m31660/Pycharm/nebula/insert_gcov_data.py", line 64, in create_nebula_root_client success = connection_pool.init([('10.113.36.125', 9669)], config) File "/home/chatgpt/.local/lib/python3.10/site-packages/nebula3/gclient/net/ConnectionPool.py", line 83, in init raise RuntimeError( RuntimeError: The services status exception: [services: ('10.113.36.125', 9669), status: BAD] 必须要重启nebula才可以运行的通。请问有人知道这是什么问题吗?

SerenNoble avatar Apr 30 '25 07:04 SerenNoble

Could you provide more details? You can try the following:

  1. Eliminate network issues first
  2. Make sure your remote port is open (the address seems to be deployed on the server)
  3. Check whether the nebula-python version corresponds to the nebula graph version. You can refer to here.

If the problem still exists after eliminating the above problems. You are welcome to provide more details, and feel free to ask.

Fengzdadi avatar Jun 05 '25 14:06 Fengzdadi