错误 NoHostAvailableException:所有尝试查询的主机均失败(已尝试:/127.0.0.1:9042
Error NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.1:9042
我最近开始学习 cassandra 并使用 DataStax Java 驱动程序学习 cassandra 的在线教程。我只是想在我的笔记本电脑上连接一个本地主机节点。
设置详细信息-
OS - 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),但它没有用。
请指出可能存在的问题。
schema_usertypes
的错误似乎是驱动程序正在尝试寻找 table,但可能与此 Jira 有关。
你说你是 运行 Cassandra 的 2.1-SNAPSHOT?尝试卡桑德拉 2.1.15。您的 Cassandra 节点上似乎有问题,驱动程序能够与您的集群通信,因为它试图在 schema_usertypes
.
中查找数据
我最近开始学习 cassandra 并使用 DataStax Java 驱动程序学习 cassandra 的在线教程。我只是想在我的笔记本电脑上连接一个本地主机节点。
设置详细信息-
OS - 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),但它没有用。
请指出可能存在的问题。
schema_usertypes
的错误似乎是驱动程序正在尝试寻找 table,但可能与此 Jira 有关。
你说你是 运行 Cassandra 的 2.1-SNAPSHOT?尝试卡桑德拉 2.1.15。您的 Cassandra 节点上似乎有问题,驱动程序能够与您的集群通信,因为它试图在 schema_usertypes
.