cassandra之DataStax Java 驱动程序 2.0.0-beta2 与 Cassandra 1.2.1 : unsupported protocol version
我想知道 com.datastax.cassandra:cassandra-driver-core:2.0.0-beta2 是否可以与 org.apache.cassandra:cassandra-all:1.2.1 一起使用。我正在使用 cassandra-maven-plugin:1.2.1-1(它使用 org.apache.cassandra:cassandra-all:1.2.1),添加
start_native_transport: true
native_transport_port: ${cassandra.nativePort}
到
yaml
插件属性。我可以成功 telnet 到该端口。
但是,当我尝试通过以下代码进行连接时,
// Ports.NATIVE has the same value as "${cassandra.nativePort}" above
Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1")
.withPort(Ports.NATIVE).build();
Session session = cluster.connect();
我收到以下异常:
com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1 (com.datastax.driver.core.ConnectionException: [/127.0.0.1] Unexpected error during transport initialization (com.datastax.driver.core.TransportException: [/127.0.0.1] Unexpected exception triggered (com.datastax.driver.core.exceptions.DriverInternalError: Server response from unsupported protocol version: 1))))
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:179)
at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:77)
at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:868)
at com.datastax.driver.core.Cluster$Manager.newSession(Cluster.java:888)
at com.datastax.driver.core.Cluster$Manager.access$200(Cluster.java:792)
at com.datastax.driver.core.Cluster.connect(Cluster.java:155)
我认为它的关键是
Server response from unsupported protocol version: 1
.
这是否意味着 2.0.0-beta2 驱动程序不能与 Cassandra 1.2.1 一起使用?驱动程序/服务器兼容性矩阵在哪里?
我已经为此烧了将近一天。
谢谢,
马修
请您参考如下方法:
是的,不兼容。 From the java-driver 2.0 requirements :
The driver uses Casandra's native protocol, and this version 2.0 uses the second version of that protocol. As such, this version of the driver requires a version of Cassandra greater than or equal to 2.0 (for Cassandra 1.2 please use the version 1.0 of the driver).
尝试降级到 1.0,最新版本是 1.0.4:
<dependency>
<groupId>com.datastax.cassandra</groupId>
<artifactId>cassandra-driver-parent</artifactId>
<version>1.0.4</version>
</dependency>
1.本站遵循行业规范,任何转载的稿件都会明确标注作者和来源;2.本站的原创文章,请转载时务必注明文章作者和来源,不尊重原创的行为我们将追究责任;3.作者投稿可能会经我们编辑修改或补充。