GBase 8a集群V95版本JDBC连接超时参数设置避免半数节点故障时长时间卡住不返回

GBase 8a数据库集群的V95版本,当集群出现半数gcwae故障时,会卡住,而JDBC接口也会卡住。本文介绍通过参数设置超时时间的方案,让用户尽快知晓集群故障。

如下2个参数,单位毫秒:
connectTimeout=3000
socketTimeout=3000

import java.sql.Connection;
import java.sql.DriverManager;

public class TestConnectionTimeout {
	public static void main(String[] args) throws Exception {
		String URL = "jdbc:gbase://192.168.56.1:52582/testdb?user=gbase&password=gbase20110531&connectTimeout=3000&socketTimeout=3000";
		// // System.out.println(URL);
		Class.forName("com.gbase.jdbc.Driver");
		
		Connection con = DriverManager.getConnection(URL);
		System.out.println(con);
		con.close();

	}
}

注意其中的sockerTimeout参数需要设置,不能只设置connectTimeout。

参考

GBase 8a集群常见故障V95版本gcadmin命令卡住

GBase 8a集群V95版本gccli连接时参数设置避免半数节点故障时长时间卡住不返回

GBase 8a集群V95版本JDBC连接超时参数设置避免半数节点故障时长时间卡住不返回》有1条评论

评论已关闭。