从java代码连接cassandra集群时出错

时间:2016-10-11 17:56:58

标签: cassandra google-cloud-platform datastax datastax-enterprise

我已经在google云中部署了datastax cassandra集群,并且能够从cqlsh加载数据和查询,但无法从JAVA代码连接。获取以下错误消息。

Cassandra版本

&

错误消息

3.0.7

nodetool status

<searchResultResponse><error><errorCode>200</errorCode><errorMessage>All host(s) tried for query failed (tried: /104.155.229.139:9042 (com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table schema_keyspaces))</errorMessage></error></searchResultResponse>
来自其中一个节点的

Cassandray.yaml

Datacenter: asia-east1-a

========================

Status=Up/Down

|/ State=Normal/Leaving/Joining/Moving

--  Address     Load       Tokens       Owns    Host ID                               Rack

UN  xx.xxx.x.4  974.53 MB  64           ?       e7974879-647f-460a-ac2e-0828bcefe7cb  asia-east1-a

UN  xx.xxx.x.2  832.5 MB   64           ?       4d152508-d9ea-4fea-89a6-ef3e86b036ac  asia-east1-a

UN  xx.xxx.x.3  942.64 MB  64           ?       de4798b7-2a74-4104-be0b-1ed093183276  asia-east1-a

Datacenter: europe-west1-b

==========================

Status=Up/Down

|/ State=Normal/Leaving/Joining/Moving

--  Address     Load       Tokens       Owns    Host ID                               Rack

UN  xx.xxx.x.4  849.3 MB   64           ?       a9af8255-8f09-4d41-a9a5-5ce769b47cd6  europe-west1-b

UN  xx.xxx.x.2  906.62 MB  64           ?       3389e168-cf8e-4bd2-8947-cbfd42187a64  europe-west1-b

UN  xx.xxx.x.3  945.59 MB  64           ?       c2a561fc-6fa1-440d-8f42-e85a866ed48a  europe-west1-b

Datacenter: us-east1-b
======================

Status=Up/Down

|/ State=Normal/Leaving/Joining/Moving

--  Address     Load       Tokens       Owns    Host ID                               Rack

UN  xx.xxx.x.4  904.41 MB  64           ?       43b49588-841b-4925-bf3f-ab59ca227186  us-east1-b

UN  xx.xxx.x.2  953.32 MB  64           ?       d658b8c8-ee24-4e15-9240-7c4aac92f723  us-east1-b

UN  xx.xxx.x.3  843.16 MB  64           ?       1ee956b8-3823-4324-ac8f-582d312851b3  us-east1-b

谢谢,

1 个答案:

答案 0 :(得分:1)

根据它尝试解析的表名,您可能正在使用早于3.0的datastax java驱动程序版本。 Cassandra 3.0改变了模式表的解析方式,因此您需要一个java-driver 3.0或更高版本(3.1.1是最新版本)。