无法建立连接,所有尝试查询的主机均失败

Unable to establish connection, All host(s) tried for query failed

我知道这可能是一个基本问题,但由于我是 cassandra 的新手并且没有在任何地方找到它的解决方案所以当我试图在 DataStax Dev Center 中连接到 cassandra 服务器时,它给了我以下异常。

系统配置如下:

操作系统:Windows 10 pro(64 位)

apache-cassandra-3.11.2

下面是cassandra.yaml配置:

start_native_transport: true

broadcast_rpc_address: 1.2.3.4

native_transport_port_ssl: 9142

listen_address: 192.168.2.22

rpc_address: 192.x.x.x

我在 cassandra.yaml 文件中做了这些更改:start_rpc: true rpc_port: 9042

当 运行 在 cmd 上执行此命令时:nodetool -h localhost -p 9042 status

出现此错误:Failed to connect to 'localhost:9042' - ConnectIOException: 'non-JRMP server at remote endpoint'.

如有任何帮助,我们将不胜感激。

您似乎已将 native-transport-port 配置为 :9142,但您正在尝试通过开发中心连接到 9042 端口。请更正并验证。

您已将 rpc (rpc_port) 设置为使用与 cql (native_transport_port) 相同的端口。您确定要使用 rpc 吗?这是旧的已弃用接口,除非您需要它以实现向后兼容性,否则不应使用它。

如果您真的想使用 rpc,那么它必须是 native_transport_port 以外的另一个端口。

您应该为 nodetool 使用 jmx 端口(默认 7199)

我已经找到了这个问题的答案,以下是第一次安装 Cassandra 时需要配置的配置:

broadcast_rpc_address: 192.168.2.22(ip address of system on which Cassandra is installed

rpc_address: 0.0.0.0