nebualGraph2.0.0 client 调用图数据库报错

public static void init() throws Exception {
		NebulaPoolConfig nebulaPoolConfig = new NebulaPoolConfig();
		nebulaPoolConfig.setMaxConnSize(1000);
		List<HostAddress> addresses = Arrays.asList(
//		        new HostAddress("10.177.41.240", 9669),
//		        new HostAddress("10.177.112.178", 9669), 
//	            new HostAddress("10.177.112.177", 9669));
				new HostAddress("10.130.166.241", 9669),
		        new HostAddress("10.130.166.242", 9669),
		        new HostAddress("10.130.166.243", 9669),
		        new HostAddress("10.128.31.23", 9669),
		        new HostAddress("10.131.55.170", 9669), 
		        new HostAddress("10.131.55.171", 9669));
		 pool = new NebulaPool();
		pool.init(addresses, nebulaPoolConfig);
		session = pool.getSession("user", "password", false);
		
	
	}
	@Test
	@JUnitPerfTest(threads = 10, durationMs = 10*1000, warmUpMs = 7000)
	// @JunitPerfConfig(threads = 10, warmUp = 10, duration = 30 , reporter ={HtmlReporter.class, ConsoleReporter.class})
	public  void searchVertex() throws ConnectionException, TException {

		System.out.println("********************* search vertex sumbit *********************");
		String thing_name = "刘德华";
		try {
			String ngql="use  knowledge_graph_test3;LOOKUP ON Thing WHERE Thing.Thing_name == \""+thing_name+"\" YIELD Thing.Thing_name;\"";
			ResultSet resultSet = session.execute(ngql);
		//String ret=	resultSet.getRows().get(0).toString();
			//System.out.println(ret);
		} catch (Exception e) {
			e.printStackTrace();
			System.err.println("*********************"+e.toString());
		}
		
		

	}

报错

    at java.lang.Thread.run(Thread.java:748)
*********************com.vesoft.nebula.client.graph.exception.IOErrorException: Expected protocol id ffffff82 but got 0
com.vesoft.nebula.client.graph.exception.IOErrorException: Expected protocol id ffffff82 but got 36
        at com.vesoft.nebula.client.graph.net.SyncConnection.execute(SyncConnection.java:74)
        at com.vesoft.nebula.client.graph.net.Session.execute(Session.java:46)
        at com.oppoer.pqrtest.NebulaGraphTest2.searchVertex(NebulaGraphTest2.java:76)
        at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
        at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
        at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)^C
   at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)

Caused by: com.vesoft.nebula.client.graph.exception.IOErrorException: java.net.SocketException: 断开的管道 (Write failed)
at com.vesoft.nebula.client.graph.net.SyncConnection.execute(SyncConnection.java:74)
at com.vesoft.nebula.client.graph.net.Session.execute(Session.java:46)
at com.oppoer.pqrtest.NebulaGraphTest4.lambda$5(NebulaGraphTest4.java:108)
at java.util.concurrent.ForkJoinTask$AdaptedCallable.exec(ForkJoinTask.java:1424)

服务正常么

服务我重启了,还是报错

用console连接呢

可以连接

是不是客户端版本问题,我服务是2.1.0 ,客户端是2.0.0

最好用同版本试试

客户端只有1.0.0 1.0.0
1.0.1 1.1.0,1.2.0
1.1.0 1.1.0,1.2.0
1.2.0 1.1.0,1.2.0,1.2.1
2.0.0-beta 2.0.0-beta
2.0.0-rc1 2.0.0-rc1
2.0.0 >= 2.0.0
2.0.0-SNAPSHOT 2.0.0-nightly

用console连接看看

session要在每次查询的时候从pool里获取,用完之后还要释放。。不能再初始化 的时候就初始化一个session

com.vesoft.nebula.client.graph.exception.IOErrorException: Expected protocol id ffffff82 but got 61
com.vesoft.nebula.client.graph.exception.IOErrorException: Expected protocol id ffffff82 but got 65
at com.vesoft.nebula.client.graph.net.SyncConnection.execute(SyncConnection.java:74)
at com.vesoft.nebula.client.graph.net.Session.execute(Session.java:46)
at com.oppoer.pqrtest.NebulaGraphTest2.searchVertex(NebulaGraphTest2.java:78)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at com.github.noconnor.junitperf.statements.EvaluationTask.evaluateStatement(EvaluationTask.java:51)
at com.github.noconnor.junitperf.statements.EvaluationTask.run(EvaluationTask.java:44)
at java.lang.Thread.run(Thread.java:748)
*********************com.vesoft.nebula.client.graph.exception.IOErrorException: Expected protocol id ffffff82 but got 65

好的session 我改一下,但是报下面的IOErrorException 是什么问题啊

********************com.vesoft.nebula.client.graph.exception.AuthFailedException: Auth failed: Authenticate failed: Expected protocol id ffffff82 but got 19
com.vesoft.nebula.client.graph.exception.AuthFailedException: Auth failed: Authenticate failed: Expected protocol id ffffff82 but got 2c
at com.vesoft.nebula.client.graph.net.SyncConnection.authenticate(SyncConnection.java:59)
at com.vesoft.nebula.client.graph.net.NebulaPool.getSession(NebulaPool.java:108)
at com.oppoer.pqrtest.NebulaGraphTest2.searchThirdVertex(NebulaGraphTest2.java:146)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at com.github.noconnor.junitperf.statements.EvaluationTask.evaluateStatement(EvaluationTask.java:51)
at com.github.noconnor.junitperf.statements.EvaluationTask.run(EvaluationTask.java:44)
at java.lang.Thread.run(Thread.java:748)
*********************com.vesoft.nebula.client.graph.exception.AuthFailedException: Auth failed: Authenticate failed: Expected protocol id ffffff82 but got 2c

session 改了还是报这异常
@Test
@JUnitPerfTest(threads = 10, durationMs = 301000, warmUpMs = 7000)
// @JunitPerfConfig(threads = 10, warmUp = 10, duration = 30 , reporter = {HtmlReporter.class, ConsoleReporter.class})
public void searchThirdVertex() throws ConnectionException, TException {
String thing_name = “刘德华”;
try {
session = pool.getSession(“user”, “password”, false);
System.out.println("
******************** search out 3 vertex sumbit ");
String ngql=“use knowledge_graph_test3;LOOKUP ON Thing WHERE Thing.Thing_name == “”+thing_name+”" | GO 1 STEPS FROM $-.VertexID OVER Thing_type YIELD $$.Thing.Thing_name,$$.Thing.Thing_urls;";
ResultSet resultSet = session.execute(ngql);
session.release();
} catch (Exception e) {
e.printStackTrace();
System.err.println("
"+e.toString());
}

我在压力测试。是不是,client 连接池,扛不住高并发啊,要调大连接池配置吗

你这明显的认证失败啊

这个是一开始可以,但压力测试过一段时间就报这个错了,是session 失效??

javaSDK的NebulaPool里maxConnsSize的默认大小是10,你这多个线程请求肯定不够用啊。修改NebulaPoolConfig的maxConnsSize大一点试试