【发布时间】:2017-02-17 08:43:24
【问题描述】:
我最近开始学习 cassandra,并通过 DataStax Java 驱动程序浏览了 cassandra 的在线教程。我只是想在我的笔记本电脑上连接一个 localhost 节点。
设置详情 -
操作系统 - Windows 7
Cassandra 版本 - Cassandra 版本:2.1-SNAPSHOT
DataStax java 驱动版本 - 3.1.0
我可以使用 CQLSH 和 cassandra-cli 客户端连接到本地节点。 我还可以看到默认的键空间系统和 system_traces。 下面是cassandra服务器日志
INFO 12:12:51 Node localhost/127.0.0.1 state jump to normal
INFO 12:12:51 Startup completed! Now serving reads.
INFO 12:12:51 Starting listening for CQL clients on /0.0.0.0:9042...
INFO 12:12:51 Binding thrift service to /0.0.0.0:9160
INFO 12:12:51 Using TFramedTransport with a max frame size of 15728640 bytes.
INFO 12:12:51 Using synchronous/threadpool thrift server on 0.0.0.0 : 9160
INFO 12:12:51 Listening for thrift clients...
我正在尝试下面的简单代码 -
Cluster cluster = Cluster.builder().addContactPoint("127.0.0.1").build();
Metadata metadata = cluster.getMetadata();
此代码引发以下异常 - 跟踪的一部分
com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042 (com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured columnfamily schema_usertypes))
at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:233)
我已经解决了之前提出的所有问题。大多数答案都建议更改 cassandra.yaml 文件中的配置。
我的 cassandra.yaml 配置是 -
start_native_transport: true
native_transport_port: 9042
listen_address: localhost
rpc_address: 0.0.0.0
rpc_port: 9160
大多数答案都建议在 rpc_address 使用机器的实际 IP 地址,我尝试过但没有成功。
这是我遇到的问题 - Question One,Question two,Question three,Topic,Connection requirement,Question four。
This page 列出了 Java DataStax 驱动程序与 cassandra 版本的兼容性,因此我将驱动程序版本更改为 2.1.1(因为我使用的是 cassandra 2.1),但它不起作用。
请提出可能的问题。
【问题讨论】:
标签: java cassandra connection datastax