VGet: "Failed to get a connection to the cluster".
I've installed the Vertica 7 VM image and I'm trying to use the new key/value feature. This is the program that I'm trying to run:
import java.sql.*;import com.vertica.jdbc.kv.*;
public class verticaKV2 {
public static void main(String[] args) {
com.vertica.jdbc.DataSource jdbcSettings
= new com.vertica.jdbc.DataSource();
jdbcSettings.setDatabase("VMART");
jdbcSettings.setHost("192.168.204.140");
jdbcSettings.setUserID("dbadmin");
jdbcSettings.setPassword("password");
jdbcSettings.setEnableRoutableQueries(true);
jdbcSettings.setFailOnMultiNodePlans(false);
jdbcSettings.setPort((short)5433);
VerticaRoutableConnection conn;
try {
conn = (VerticaRoutableConnection)
jdbcSettings.getConnection();
System.out.println("Connected.");
VGet get = conn.prepareGet("public", "customer_dimension");
get.addPredicate("customer_key", 5);
ResultSet rs = get.execute();
rs.next();
System.out.println("ID: " +
rs.getString("customer_key"));
System.out.println("Username: "
+ rs.getString("customer_name"));
System.out.println("Closing Connection.");
conn.close();
} catch (SQLException e) {
System.out.println("Error! Stacktrace:");
e.printStackTrace();
}
}
}
I'm getting an exception in the VGet get = conn.prepareGet("public", "customer_dimension"); line: "Failed to get a connection to the cluster".
What might be the cause? I'm using the tables that are coming in the example database and I registered the copy with a community edition license.
thanks,
Santiago
import java.sql.*;import com.vertica.jdbc.kv.*;
public class verticaKV2 {
public static void main(String[] args) {
com.vertica.jdbc.DataSource jdbcSettings
= new com.vertica.jdbc.DataSource();
jdbcSettings.setDatabase("VMART");
jdbcSettings.setHost("192.168.204.140");
jdbcSettings.setUserID("dbadmin");
jdbcSettings.setPassword("password");
jdbcSettings.setEnableRoutableQueries(true);
jdbcSettings.setFailOnMultiNodePlans(false);
jdbcSettings.setPort((short)5433);
VerticaRoutableConnection conn;
try {
conn = (VerticaRoutableConnection)
jdbcSettings.getConnection();
System.out.println("Connected.");
VGet get = conn.prepareGet("public", "customer_dimension");
get.addPredicate("customer_key", 5);
ResultSet rs = get.execute();
rs.next();
System.out.println("ID: " +
rs.getString("customer_key"));
System.out.println("Username: "
+ rs.getString("customer_name"));
System.out.println("Closing Connection.");
conn.close();
} catch (SQLException e) {
System.out.println("Error! Stacktrace:");
e.printStackTrace();
}
}
}
I'm getting an exception in the VGet get = conn.prepareGet("public", "customer_dimension"); line: "Failed to get a connection to the cluster".
What might be the cause? I'm using the tables that are coming in the example database and I registered the copy with a community edition license.
thanks,
Santiago
0
Comments
sorry, but I don't understand what you're asking me. This is the vertica's log:
2014-04-03 06:32:44.745 Init Session:0x2aab30013e60 <LOG> @v_db_test_node0001: 00000/2705: Connection received: host=192.168.1.14 port=58485 (connCnt 3)
2014-04-03 06:32:44.749 Init Session:0x2aab30013e60 <LOG> @v_db_test_node0001: 00000/4686: sendAuthRequest: user=dbadmin database=db_test host=192.168.1.14 authType=0
2014-04-03 06:32:44.749 Init Session:0x2aab30013e60 <LOG> @v_db_test_node0001: 00000/2703: Connection authenticated: user=dbadmin database=db_test host=192.168.1.14
2014-04-03 06:32:44.749 Init Session:0x2aab30013e60 <LOG> @v_db_test_node0001: 00000/2609: Client pid: 22123
2014-04-03 06:32:44.749 Init Session:0x2aab30013e60 <LOG> @v_db_test_node0001: 00000/2608: Client label: jdbc-07.00.0000-93d24e5a-d5eb-44df-ba18-22d46b618dfe
2014-04-03 06:32:44.793 Init Session:0x2aab30013e60 [Session] <INFO> [Query] TX:0(vertica-4006:0x708b) set session autocommit to on
2014-04-03 06:32:44.814 Init Session:0x2aab30013e60 [Session] <INFO> [PQuery] TX:0(vertica-4006:0x708b) select node_name, node_port from node_resources
2014-04-03 06:32:44.814 Init Session:0x2aab30013e60 [Session] <INFO> [Query] TX:0(vertica-4006:0x708b) select node_name, node_port from node_resources
2014-04-03 06:32:44.815 Init Session:0x2aab30013e60-a0000000003af2 [Txn] <INFO> Begin Txn: a0000000003af2 'select node_name, node_port from node_resources'
2014-04-03 06:32:44.820 Init Session:0x2aab30013e60-a0000000003af2 [Txn] <INFO> Starting Commit: Txn: a0000000003af2 'select node_name, node_port from node_resources'
2014-04-03 06:32:44.821 Init Session:0x2aab30013e60 [Txn] <INFO> Commit Complete: Txn: a0000000003af2 at epoch 0x3c1
2014-04-03 06:32:44.858 Init Session:0x2aab30013e60 [Session] <INFO> [PQuery] TX:0(vertica-4006:0x708b) select node_name, node_address, export_address from nodes
2014-04-03 06:32:44.858 Init Session:0x2aab30013e60 [Session] <INFO> [Query] TX:0(vertica-4006:0x708b) select node_name, node_address, export_address from nodes
2014-04-03 06:32:44.859 Init Session:0x2aab30013e60-a0000000003af4 [Txn] <INFO> Begin Txn: a0000000003af4 'select node_name, node_address, export_address from nodes'
2014-04-03 06:32:44.870 Init Session:0x2aab30013e60-a0000000003af4 [Txn] <INFO> Starting Commit: Txn: a0000000003af4 'select node_name, node_address, export_address from nodes'
2014-04-03 06:32:44.870 Init Session:0x2aab30013e60 [Txn] <INFO> Commit Complete: Txn: a0000000003af4 at epoch 0x3c1
2014-04-03 06:32:45.239 Init Session:0x2aab30013e60 <LOG> @v_db_test_node0001: 08006/5167: Unexpected EOF on client connection
2014-04-03 06:32:45.239 Init Session:0x2aab30013e60 <LOG> @v_db_test_node0001: 00000/4719: Session vertica-4006:0x708b ended; closing connection (connCnt 3)
Any clue from here?
thanks,
Santiago
((VerticaConnection)dbconn).setProperty("ResultBufferSize", "0" );
If there any idle connection timeout configured at firewall/application level?
Same thing, isn't there anything meaningful in the log I copied before?
2014-04-03 06:32:44.870 Init Session:0x2aab30013e60-a0000000003af4 [Txn] <INFO> Starting Commit: Txn: a0000000003af4 'select node_name, node_address, export_address from nodes'
2014-04-03 06:32:44.870 Init Session:0x2aab30013e60 [Txn] <INFO> Commit Complete: Txn: a0000000003af4 at epoch 0x3c1
2014-04-03 06:32:45.239 Init Session:0x2aab30013e60 <LOG> @v_db_test_node0001: 08006/5167: Unexpected EOF on client connection
2014-04-03 06:32:45.239 Init Session:0x2aab30013e60 <LOG> @v_db_test_node0001: 00000/4719: Session vertica-4006:0x708b ended; closing connection (connCnt 3)
Please try using the below version of SDK
$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.8) (rhel-1.56.1.11.8.el6_3-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
I could connect and get the data
java -cp vertica-jdbc-7.0.1-0.jar:. verticaKV2
what was your version?
select * from nodes;
v_cswsaxdst_node0003 45035996273719008 UP 172.16.200.57 172.16.200.57 /data/vertica/cswsaxdst/v_cswsaxdst_node0003_catalog/Catalog 0
v_cswsaxdst_node0004 45035996273719012 UP 172.16.200.58 172.16.200.58 /data/vertica/cswsaxdst/v_cswsaxdst_node0004_catalog/Catalog 0
the following sql statements should resolve the issue assuming I have used the right ip addresses.
CREATE NETWORK INTERFACE ni1 ON v_cswsaxdst_node0001 WITH '192.168.204.140';
CREATE NETWORK INTERFACE ni2 ON v_cswsaxdst_node0002 WITH '192.168.204.141';
CREATE NETWORK INTERFACE ni3 ON v_cswsaxdst_node0003 WITH '192.168.204.142';
CREATE NETWORK INTERFACE ni4 ON v_cswsaxdst_node0004 WITH '192.168.204.143';
ALTER NODE v_cswsaxdst_node0001 EXPORT ON ni1;
ALTER NODE v_cswsaxdst_node0002 EXPORT ON ni2;
ALTER NODE v_cswsaxdst_node0003 EXPORT ON ni3;
ALTER NODE v_cswsaxdst_node0004 EXPORT ON ni4;
CREATE TABLE MY_TABLE
(
MSISDN INT NOT NULL,
date_sid INT NOT NULL,
MEASURE1 NUMERIC,
MEASURE2 NUMERIC
)
PARTITION BY DATE_SID;
CREATE PROJECTION MY_TABLE_p0
(
MSISDN,
date_sid,
MEASURE1,
MEASURE2
)
AS
SELECT
MSISDN,
date_sid,
MEASURE1,
MEASURE2
FROM MY_TABLE
ORDER BY MSISDN
SEGMENTED BY HASH(MSISDN) ALL NODES KSAFE;
public class verticaKV2 {
public static void main(String[] args) {
com.vertica.jdbc.DataSource jdbcSettings
= new com.vertica.jdbc.DataSource();
jdbcSettings.setDatabase("my_db");
jdbcSettings.setHost("myserver.com");
jdbcSettings.setUserID("my_user");
jdbcSettings.setPassword("password");
jdbcSettings.setEnableRoutableQueries(true);
jdbcSettings.setPort((short)5433);
VerticaRoutableConnection conn;
try {
conn = (VerticaRoutableConnection)
jdbcSettings.getConnection();
System.out.println("Connected.");
VGet get = conn.prepareGet("my_db", "MY_TABLE");
get.addPredicate("msisdn", 1);
ResultSet rs = get.execute();
rs.next();
System.out.println("ID: " +
rs.getString("msisdn"));
System.out.println("Closing Connection.");
conn.close();
} catch (SQLException e) {
System.out.println("Error! Stacktrace:");
e.printStackTrace();
}
}
}
the error:
Error! Stacktrace:
java.sql.SQLNonTransientException: [Vertica][VJDBC](2242) ROLLBACK: Attempt to run multi-node KV plan
at com.vertica.util.ServerErrorData.buildException(Unknown Source)
at com.vertica.dataengine.VResultSet.fetchChunk(Unknown Source)
at com.vertica.dataengine.VResultSet.initialize(Unknown Source)
at com.vertica.dataengine.VQueryExecutor.readExecuteResponse(Unknown Sou
rce)
at com.vertica.dataengine.VQueryExecutor.handleExecuteResponse(Unknown S
ource)
at com.vertica.dataengine.VQueryExecutor.execute(Unknown Source)
at com.vertica.jdbc.common.SStatement.executeNoParams(Unknown Source)
at com.vertica.jdbc.common.SStatement.executeQuery(Unknown Source)
at com.vertica.jdbc.kv.RoutableQuery.runQuery(Unknown Source)
at com.vertica.jdbc.kv.RoutableQuery.execute(Unknown Source)
at com.vertica.jdbc.kv.VGetImpl.execute(Unknown Source)
at verticaKV2.main(verticaKV2.java:22)
Caused by: com.vertica.support.exceptions.NonTransientException: [Vertica][VJDBC
](2242) ROLLBACK: Attempt to run multi-node KV plan
... 12 more