Cassandra ERROR: java.io.IOException: failed to connect to /127.0.0.1:7000 for streaming data

Cassandra ERROR: java.io.IOException: failed to connect to /127.0.0.1:7000 for streaming data

我正在从官方 Cassandra 的 docker 映像中 运行 安装 Cassandra 的容器(版本 3.11.11)。当我运行命令行从其他Cassandra的数据库复制数据(复制数据)时,容器给出了错误:java.io.IOException: failed to connect to /127.0.0.1:7000 for streaming data.

但是容器的nod​​etool状态是OK的:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address     Load       Tokens  Owns (effective)  Host ID                               Rack
UN  172.18.0.2  374.3 KiB  16      100.0%            8a8a2e50-4478-431b-9271-a15a2f76f92c  rack1

这是ss -tulwn | grep LISTEN:

tcp    LISTEN  0       128         172.18.0.2:7000         0.0.0.0:*
tcp    LISTEN  0       50           127.0.0.1:7199         0.0.0.0:*
tcp    LISTEN  0       128         127.0.0.11:46753        0.0.0.0:*
tcp    LISTEN  0       50           127.0.0.1:45251        0.0.0.0:*
tcp    LISTEN  0       128            0.0.0.0:9042         0.0.0.0:*

命令行: $ cd /var/lib/cassandra/data/appkeyspace/ && find /var/lib/cassandra/data/appkeyspace/ -maxdepth 5 -type d -exec sstableloader -v --nodes 127.0.0.1 {} \;

完整 Stactrace:

Established connection to initial hosts
Opening sstables and calculating sections to stream
Streaming relevant part of /var/lib/cassandra/data/appkeyspace/table1-372d129022f711ec918521a73dc809ec/md-1-big-Data.db  to [/127.0.0.1:7000]
ERROR 00:06:20,312 [Stream #b2819850-36b9-11ec-8f73-f580fd65fadb] Streaming error occurred on session with peer 127.0.0.1:7000
java.io.IOException: failed to connect to /127.0.0.1:7000 for streaming data
        at org.apache.cassandra.streaming.DefaultConnectionFactory.createConnection(DefaultConnectionFactory.java:55)
        at org.apache.cassandra.tools.BulkLoadConnectionFactory.createConnection(BulkLoadConnectionFactory.java:52)
        at org.apache.cassandra.streaming.async.NettyStreamingMessageSender.createChannel(NettyStreamingMessageSender.java:199)
        at org.apache.cassandra.streaming.async.NettyStreamingMessageSender.setupControlMessageChannel(NettyStreamingMessageSender.java:180)
        at org.apache.cassandra.streaming.async.NettyStreamingMessageSender.sendMessage(NettyStreamingMessageSender.java:245)
        at org.apache.cassandra.streaming.async.NettyStreamingMessageSender.initialize(NettyStreamingMessageSender.java:149)
        at org.apache.cassandra.streaming.StreamSession.start(StreamSession.java:362)
        at org.apache.cassandra.streaming.StreamCoordinator.startSession(StreamCoordinator.java:262)
        at org.apache.cassandra.streaming.StreamCoordinator.access0(StreamCoordinator.java:36)
        at org.apache.cassandra.streaming.StreamCoordinator$HostStreamingData.connectAllStreamSessions(StreamCoordinator.java:308)
        at org.apache.cassandra.streaming.StreamCoordinator.connectAllStreamSessions(StreamCoordinator.java:107)
        at org.apache.cassandra.streaming.StreamCoordinator.connect(StreamCoordinator.java:101)
        at org.apache.cassandra.streaming.StreamResultFuture.createInitiator(StreamResultFuture.java:98)
        at org.apache.cassandra.streaming.StreamPlan.execute(StreamPlan.java:179)
        at org.apache.cassandra.io.sstable.SSTableLoader.stream(SSTableLoader.java:215)
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:83)
        at org.apache.cassandra.tools.BulkLoader.main(BulkLoader.java:51)
Caused by: io.netty.channel.AbstractChannel$AnnotatedConnectException: finishConnect(..) failed: Connection refused: /127.0.0.1:7000
Caused by: java.net.ConnectException: finishConnect(..) failed: Connection refused
        at io.netty.channel.unix.Errors.throwConnectException(Errors.java:124)
        at io.netty.channel.unix.Socket.finishConnect(Socket.java:251)
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.doFinishConnect(AbstractEpollChannel.java:673)
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.finishConnect(AbstractEpollChannel.java:650)
        at io.netty.channel.epoll.AbstractEpollChannel$AbstractEpollUnsafe.epollOutReady(AbstractEpollChannel.java:530)
        at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:470)
        at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:378)
        at io.netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:989)
        at io.netty.util.internal.ThreadExecutorMap.run(ThreadExecutorMap.java:74)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.base/java.lang.Thread.run(Unknown Source)
progress: total: 100% 0.000KiB/s (avg: 0.000KiB/s)
WARN  00:06:20,371 [Stream #b2819850-36b9-11ec-8f73-f580fd65fadb] Stream failed
ERROR 00:06:20,407 [Stream #b2819850-36b9-11ec-8f73-f580fd65fadb] Streaming error occurred on session with peer 127.0.0.1:7000
java.lang.RuntimeException: stream has been closed, cannot send Prepare SYN (0 requests,  7 files}
        at org.apache.cassandra.streaming.async.NettyStreamingMessageSender.sendMessage(NettyStreamingMessageSender.java:231)
        at org.apache.cassandra.streaming.StreamSession.onInitializationComplete(StreamSession.java:623)
        at org.apache.cassandra.streaming.StreamSession.start(StreamSession.java:363)
        at org.apache.cassandra.streaming.StreamCoordinator.startSession(StreamCoordinator.java:262)
        at org.apache.cassandra.streaming.StreamCoordinator.access0(StreamCoordinator.java:36)
        at org.apache.cassandra.streaming.StreamCoordinator$HostStreamingData.connectAllStreamSessions(StreamCoordinator.java:308)
        at org.apache.cassandra.streaming.StreamCoordinator.connectAllStreamSessions(StreamCoordinator.java:107)
        at org.apache.cassandra.streaming.StreamCoordinator.connect(StreamCoordinator.java:101)
        at org.apache.cassandra.streaming.StreamResultFuture.createInitiator(StreamResultFuture.java:98)
        at org.apache.cassandra.streaming.StreamPlan.execute(StreamPlan.java:179)
        at org.apache.cassandra.io.sstable.SSTableLoader.stream(SSTableLoader.java:215)
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:83)
        at org.apache.cassandra.tools.BulkLoader.main(BulkLoader.java:51)
Streaming to the following hosts failed:
[/127.0.0.1:7000]
java.util.concurrent.ExecutionException: org.apache.cassandra.streaming.StreamException: Stream failed
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:552)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:513)
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:101)
        at org.apache.cassandra.tools.BulkLoader.main(BulkLoader.java:51)
Caused by: org.apache.cassandra.streaming.StreamException: Stream failed
        at org.apache.cassandra.streaming.management.StreamEventJMXNotifier.onFailure(StreamEventJMXNotifier.java:88)
        at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1056)
        at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
        at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1138)
        at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:958)
        at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:748)
        at org.apache.cassandra.streaming.StreamResultFuture.maybeComplete(StreamResultFuture.java:220)
        at org.apache.cassandra.streaming.StreamResultFuture.handleSessionComplete(StreamResultFuture.java:196)
        at org.apache.cassandra.streaming.StreamSession.closeSession(StreamSession.java:506)
        at org.apache.cassandra.streaming.StreamSession.onError(StreamSession.java:658)
        at org.apache.cassandra.streaming.async.NettyStreamingMessageSender.sendMessage(NettyStreamingMessageSender.java:251)
        at org.apache.cassandra.streaming.async.NettyStreamingMessageSender.initialize(NettyStreamingMessageSender.java:149)
        at org.apache.cassandra.streaming.StreamSession.start(StreamSession.java:362)
        at org.apache.cassandra.streaming.StreamCoordinator.startSession(StreamCoordinator.java:262)
        at org.apache.cassandra.streaming.StreamCoordinator.access0(StreamCoordinator.java:36)
        at org.apache.cassandra.streaming.StreamCoordinator$HostStreamingData.connectAllStreamSessions(StreamCoordinator.java:308)
        at org.apache.cassandra.streaming.StreamCoordinator.connectAllStreamSessions(StreamCoordinator.java:107)
        at org.apache.cassandra.streaming.StreamCoordinator.connect(StreamCoordinator.java:101)
        at org.apache.cassandra.streaming.StreamResultFuture.createInitiator(StreamResultFuture.java:98)
        at org.apache.cassandra.streaming.StreamPlan.execute(StreamPlan.java:179)
        at org.apache.cassandra.io.sstable.SSTableLoader.stream(SSTableLoader.java:215)
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:83)
        ... 1 more
Exception in thread "main" org.apache.cassandra.tools.BulkLoadException: java.util.concurrent.ExecutionException: org.apache.cassandra.streaming.StreamException: Stream failed
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:116)
        at org.apache.cassandra.tools.BulkLoader.main(BulkLoader.java:51)
Caused by: java.util.concurrent.ExecutionException: org.apache.cassandra.streaming.StreamException: Stream failed
        at com.google.common.util.concurrent.AbstractFuture.getDoneValue(AbstractFuture.java:552)
        at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:513)
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:101)
        ... 1 more
Caused by: org.apache.cassandra.streaming.StreamException: Stream failed
        at org.apache.cassandra.streaming.management.StreamEventJMXNotifier.onFailure(StreamEventJMXNotifier.java:88)
        at com.google.common.util.concurrent.Futures$CallbackListener.run(Futures.java:1056)
        at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30)
        at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:1138)
        at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:958)
        at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:748)
        at org.apache.cassandra.streaming.StreamResultFuture.maybeComplete(StreamResultFuture.java:220)
        at org.apache.cassandra.streaming.StreamResultFuture.handleSessionComplete(StreamResultFuture.java:196)
        at org.apache.cassandra.streaming.StreamSession.closeSession(StreamSession.java:506)
        at org.apache.cassandra.streaming.StreamSession.onError(StreamSession.java:658)
        at org.apache.cassandra.streaming.async.NettyStreamingMessageSender.sendMessage(NettyStreamingMessageSender.java:251)
        at org.apache.cassandra.streaming.async.NettyStreamingMessageSender.initialize(NettyStreamingMessageSender.java:149)
        at org.apache.cassandra.streaming.StreamSession.start(StreamSession.java:362)
        at org.apache.cassandra.streaming.StreamCoordinator.startSession(StreamCoordinator.java:262)
        at org.apache.cassandra.streaming.StreamCoordinator.access0(StreamCoordinator.java:36)
        at org.apache.cassandra.streaming.StreamCoordinator$HostStreamingData.connectAllStreamSessions(StreamCoordinator.java:308)
        at org.apache.cassandra.streaming.StreamCoordinator.connectAllStreamSessions(StreamCoordinator.java:107)
        at org.apache.cassandra.streaming.StreamCoordinator.connect(StreamCoordinator.java:101)
        at org.apache.cassandra.streaming.StreamResultFuture.createInitiator(StreamResultFuture.java:98)
        at org.apache.cassandra.streaming.StreamPlan.execute(StreamPlan.java:179)
        at org.apache.cassandra.io.sstable.SSTableLoader.stream(SSTableLoader.java:215)
        at org.apache.cassandra.tools.BulkLoader.load(BulkLoader.java:83)
        ... 1 more

感谢您的帮助。 谢谢,

我需要将 IP 127.0.0.1 更改为 172.18.0.2 才能访问端口 7000。

IP 地址 172.18.0.2 是私有 IP 地址。私有 IP 地址在局域网 (LAN) 内使用,在 Internet 上不可见。私有 IP 地址在 RFC 1918 (IPv4) 和 RFC 4193 (IPv6) 中定义。