如何使用nebula-python连接阿里云的nebula

  • nebula 版本:3.4.0
  • 部署方式:云端
  • 安装方式:源码编译 / Docker / RPM
  • 是否上生产环境:Y / N
  • 硬件信息
    • 磁盘( 推荐使用 SSD)
    • CPU、内存信息
  • 问题的具体描述
  • 相关的 meta / storage / graph info 日志信息(尽量使用文本形式方便检索)

下面是连接的代码

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([('192.168.xxx.xxx', 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('Test-China-NebulaGraph')

# 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('Test-China-NebulaGraph')
    result = session.execute('SHOW TAGS')
    print(result)

# close the pool
connection_pool.close()

报错:

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