Cassandra:NoHostAvailableException:尝试查询的所有主机失败

Cassandra :NoHostAvailableException: All host(s) tried for query failed

我正在将数据从 simplestrategy Cassandra 的数据库复制到另一个数据库。它们具有相同的键空间结构。但是,当我 运行 命令 sstableloader --nodes 出现以下错误。有谁知道如何解决这个错误?

Cassandra 的版本: 3.11.10

命令行: # sstableloader --nodes 127.0.0.0 /var/lib/cassandra/loadme/keyspace/table01-5eef6110d04111ebb620bd376a9dc9e9/snapshots/dropped-1624306636002-table01

堆栈跟踪错误:

All host(s) tried for query failed (tried: /127.0.0.0:9042 (com.datastax.driver.core.exceptions.TransportException: [/127.0.0.0] Cannot connect))
com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.0:9042 (com.datastax.driver.core.exceptions.TransportException: [/127.0.0.0] Cannot connect))
        at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:233)
        at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79)
        at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1424)
        at com.datastax.driver.core.Cluster.init(Cluster.java:163)
        at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:334)
        at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:309)
        at com.datastax.driver.core.Cluster.connect(Cluster.java:251)
        at org.apache.cassandra.utils.NativeSSTableLoaderClient.init(NativeSSTableLoaderClient.java:73)
        at org.apache.cassandra.io.sstable.SSTableLoader.stream(SSTableLoader.java:159)
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:80)
        at org.apache.cassandra.tools.BulkLoader.main(BulkLoader.java:48)
Exception in thread "main" org.apache.cassandra.tools.BulkLoadException: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.0:9042 (com.datastax.driver.core.exceptions.TransportException: [/127.0.0.0] Cannot connect))
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:93)
        at org.apache.cassandra.tools.BulkLoader.main(BulkLoader.java:48)
Caused by: com.datastax.driver.core.exceptions.NoHostAvailableException: All host(s) tried for query failed (tried: /127.0.0.0:9042 (com.datastax.driver.core.exceptions.TransportException: [/127.0.0.0] Cannot connect))
        at com.datastax.driver.core.ControlConnection.reconnectInternal(ControlConnection.java:233)
        at com.datastax.driver.core.ControlConnection.connect(ControlConnection.java:79)
        at com.datastax.driver.core.Cluster$Manager.init(Cluster.java:1424)
        at com.datastax.driver.core.Cluster.init(Cluster.java:163)
        at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:334)
        at com.datastax.driver.core.Cluster.connectAsync(Cluster.java:309)
        at com.datastax.driver.core.Cluster.connect(Cluster.java:251)
        at org.apache.cassandra.utils.NativeSSTableLoaderClient.init(NativeSSTableLoaderClient.java:73)
        at org.apache.cassandra.io.sstable.SSTableLoader.stream(SSTableLoader.java:159)
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:80)
        ... 1 more

在您的命令行中,您正在传递 --nodes 127.0.0.0 但在 netstat 输出端口 9042(本机传输)正在侦听 127.0.0.1。尝试将命令行更改为 --nodes 127.0.0.1

当您遇到错误 All host(s) tried for query failed 并且 nodetool 指示您的集群已启动并且 运行 始终确保将正确的端口绑定到您的 IP 或本地主机。