连接前提
金山云图服务支持内网访问,开始连接记忆服务之前,请确保您已准备好对应的网络环境。
连接实例
登录金山云图服务控制台,获取目标图服务实例的相关信息。
确认安全组配置是否正确。
构建图服务连接,具体示例如下:
类别 | 实例 | 参数说明 |
|---|
Python | from nebula3.gclient.net import ConnectionPool
from nebula3.Config import Config
config = Config()
config.max_connection_pool_size = 10
connection_pool = ConnectionPool()
ok = connection_pool.init([('IP地址', 端口号)], config)
session = connection_pool.get_session('用户名', '密码')
session.release()
connection_pool.close()
| |
Go | hostAddress := nebula.HostAddress{Host: "IP地址", Port: 端口号}
config, err := nebula.NewSessionPoolConf(
"user",
"password",
[]nebula.HostAddress{hostAddress},
"space_name",
)
sessionPool, err := nebula.NewSessionPool(*config, nebula.DefaultLogger{})
| |
Java | List<HostAddress> addresses = Arrays.asList(new HostAddress("IP地址", 端口号));
String spaceName = "test";
String user = "root";
String password = "nebula";
SessionPoolConfig sessionPoolConfig =
new SessionPoolConfig(addresses, spaceName, user, password)
.setMaxSessionSize(10)
.setMinSessionSize(10)
.setRetryConnectTimes(3)
.setWaitTime(100)
.setRetryTimes(3)
.setIntervalTime(100);
SessionPool sessionPool = new SessionPool(sessionPoolConfig);
| |
CPP | nebula::SessionPoolConfig config;
config.username_ = "root";
config.password_ = "nebula";
config.addrs_ = {"IP地址:端口号"};
config.spaceName_ = "session_pool_test";
config.maxSize_ = 10;
nebula::SessionPool pool(config);
assert(pool.init());
| |
Console | bash<br>./nebula-console -addr <ip> -port <port> -u <username> -p <password><br>
| |