提问参考模版:
- nebula 版本:2021.01.06-nightly, Git: 46f4a5f0, Build Time: Jan 7 2021 02:36:51
- 部署方式:三台虚拟机搭建集群
- 问题的具体描述
目前使用命令行和NebulaStudio连接、CRUD都没有问题。但是使用JavaClient中的示例代码连接失败,response的ErrorMessge是空的,ErrorCode=-5。服务端logs中有很多下面的日志
I0111 02:42:18.456056 1798 GraphService.cpp:50] Authenticating user root from 192.168.99.1:36778
E0111 02:42:18.457418 1798 GraphService.cpp:132] Session not found, id[0]
代码:
NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig();
nebulaPoolConfig.setMaxConnSize(100);
List<HostAddress> addresses = Arrays.asList(new HostAddress("192.168.99.101", 3699),
new HostAddress("192.168.99.102", 3699), new HostAddress("192.168.99.103", 3699));
pool.init(addresses, nebulaPoolConfig);
session = pool.getSession("root", "nebula", false);
{
String createSchema = "CREATE SPACE IF NOT EXISTS test; "
+ "USE test;"
+ "CREATE TAG IF NOT EXISTS person(name string, age int);"
+ "CREATE EDGE IF NOT EXISTS like(likeness double)";
ResultSet resp = session.execute(createSchema);
if (!resp.isSucceeded()) {
log.error(String.format("Execute: `%s', failed: %s",
createSchema, resp.getErrorCode()));
System.exit(1);
}
}