数据存储区中的意外连接超时cassandra -com.datastax.shaded.netty.channel.ConnectTimeoutException

时间:2015-08-19 04:35:31

标签: cassandra datastax datastax-enterprise datastax-java-driver cassandra-jdbc

我们正在第一次启动应用程序时在Session对象中获取连接。我们的调度程序使用它将数据插入到Cassandra中。但是有些时候,它获得连接超时,然后重新连接Cassandra和应用程序正常工作。

调度程序经常超时。 (我已将我的IP更改为在此帖子中)

2015-08-19 09:19:36 DEBUG Connection:274 - Defuncting connection to /*.*.*.*:9042
com.datastax.driver.core.TransportException: [/10.0.*.*:9042] Cannot connect
    at com.datastax.driver.core.Connection.<init>(Connection.java:104)
    at com.datastax.driver.core.Connection$Factory.open(Connection.java:544)
    at com.datastax.driver.core.Cluster$Manager$5.tryReconnect(Cluster.java:1652)
    at com.datastax.driver.core.AbstractReconnectionHandler.run(AbstractReconnectionHandler.java:124)
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(Unknown Source)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.datastax.shaded.netty.channel.ConnectTimeoutException: connection timed out: /*.*.*.*:9042
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:137)
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:83)
    at com.datastax.shaded.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
    at com.datastax.shaded.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at com.datastax.shaded.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    ... 3 more
2015-08-19 09:19:36 DEBUG Connection:449 - Connection[/*.*.*.*:9042-8, inFlight=0, closed=true] closing connection
2015-08-19 09:19:36 DEBUG Connection:721 - Connection[/*.*.*.*:9042-8, inFlight=0, closed=false] connection error
com.datastax.shaded.netty.channel.ConnectTimeoutException: connection timed out: /*.*.*.*:9042
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:137)
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:83)
    at com.datastax.shaded.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
    at com.datastax.shaded.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at com.datastax.shaded.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
2015-08-19 09:19:36 DEBUG Cluster:1681 - Failed reconnection to /10.0.1.18:9042 ([/*.*.*.*:9042] Cannot connect), scheduling retry in 128000 milliseconds
2015-08-19 09:19:36 DEBUG Connection:274 - Defuncting connection to /*.*.*.*:9042
com.datastax.driver.core.TransportException: [/*.*.*.*:9042] Unexpected exception triggered (com.datastax.shaded.netty.channel.ConnectTimeoutException: connection timed out: /*.*.*.*:9042)
    at com.datastax.driver.core.Connection$Dispatcher.exceptionCaught(Connection.java:727)
    at com.datastax.shaded.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
    at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at com.datastax.shaded.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at com.datastax.shaded.netty.handler.codec.oneone.OneToOneDecoder.handleUpstream(OneToOneDecoder.java:60)
    at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at com.datastax.shaded.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:791)
    at com.datastax.shaded.netty.handler.codec.frame.FrameDecoder.exceptionCaught(FrameDecoder.java:377)
    at com.datastax.shaded.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112)
    at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:564)
    at com.datastax.shaded.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:559)
    at com.datastax.shaded.netty.channel.Channels.fireExceptionCaught(Channels.java:525)
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:141)
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.process(NioClientBoss.java:83)
    at com.datastax.shaded.netty.channel.socket.nio.AbstractNioSelector.run(AbstractNioSelector.java:318)
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.run(NioClientBoss.java:42)
    at com.datastax.shaded.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108)
    at com.datastax.shaded.netty.util.internal.DeadLockProofWorker$1.run(DeadLockProofWorker.java:42)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: com.datastax.shaded.netty.channel.ConnectTimeoutException: connection timed out: /*.*.*.*:9042
    at com.datastax.shaded.netty.channel.socket.nio.NioClientBoss.processConnectTimeout(NioClientBoss.java:137)
    ... 8 more

1 个答案:

答案 0 :(得分:2)

看起来你在这里遇到连接超时。关于可能发生的事情的一些想法。

  1. SocketOptions中的连接超时调整得太低。你明确配置了吗?如果不是,则默认值为5000毫秒。
  2. 您的cassandra节点上的rpc_address的cassandra.yaml配置为客户端无法访问的私有IP接口。我注意到你的日志中存在10.x.x.x ip(Failed reconnection to /10.0.1.18:9042)。驱动程序使用rpc_address(如果rpc_address为0.0.0.0,则使用broadcast_rpc_address)连接到cassandra主机。这有可能吗?
  3. 您的C *节点已超载。如果发生这种情况,我怀疑这是C *节点,因为通常当发生这种情况时,你会得到操作(读取)超时,因为操作系统托管cassandra接受连接,但是你的C * java进程没有响应请求,因为它正在经历高暂停频繁垃圾收集的费率。在任何情况下,我都会检查你的cassandra节点上的system.log,看看是否有任何东西表明主机上下,GCInspector有很长的暂停时间,或者其他可能表明存在问题的消息。