TL; DR - DataStax java cassandraドライバからDataStax cassandraクラスタへの接続に問題があります。最初は接続して正常に動作し、突然接続が失われて再接続しません。この時点ですべてのクエリが失敗します。Cassandra javaドライバの接続エラー
詳細情報 -
だから、私はDataStaxのカサンドラドライバ3.0.0を使用しています、DataStaxカサンドラにCentOSの上の3つのノードのクラスタ2.1を実行していますよ。過去数ヶ月ですごくうまくいったのですが、最近、いくつかのスキーマの変更(つまり、既存のテーブルに列を追加する)とクエリの数の増加など、いくつかのコード変更を導入しました。この時点で切断が開始されました。
私のアプリケーションが上がったとき、それは以下のコードスニペットに示すように、それはクラスタに接続し、単一のクラスタ(およびセッション)オブジェクトを保持します。数時間後、実行されたクエリごとにNoHostAvailableException
を受信し始めます。この時点で、私は他のサーバが同じcassandraクラスタでうまく動作しているので、クラスタ自体に何も問題はないことを知っています。サーバーを再起動すると、すべて正常に動作します。
もう少し調査したところで、問題が発生すると、どちらのノードにもアクティブな接続がないことがわかります。 Iv'eはドライバをセットアップしてDEBUG
レベルのログを専用のログファイルに記録し、問題が再発するのを待っていました。数時間後、問題が再び発生した、いくつかの点で、ログファイルがこのメッセージを示しています。
Connection[/10.4.116.91:9042-1, inFlight=2, closed=false] connection error
io.netty.handler.codec.DecoderException: com.datastax.driver.core.exceptions.DriverInternalError: Adjusted frame length exceeds 268435456: 326843398 - discarded
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:418)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:245)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:962)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:485)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:399)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:371)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.datastax.driver.core.exceptions.DriverInternalError: Adjusted frame length exceeds 268435456: 326843398 - discarded
at com.datastax.driver.core.Frame$Decoder$DecoderForStreamIdSize.decode(Frame.java:239)
at com.datastax.driver.core.Frame$Decoder.decode(Frame.java:205)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:387)
... 11 common frames omitted
を、右、その後あなたがこれを参照してください。
Connection[/10.4.116.91:9042-1, inFlight=2, closed=false] connection error
io.netty.handler.codec.DecoderException: com.datastax.driver.core.exceptions.DriverInternalError: Adjusted frame length exceeds 268435456: 326843398 - discarded
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:418)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:245)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:292)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:278)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:962)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:528)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:485)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:399)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:371)
at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:112)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.datastax.driver.core.exceptions.DriverInternalError: Adjusted frame length exceeds 268435456: 326843398 - discarded
at com.datastax.driver.core.Frame$Decoder$DecoderForStreamIdSize.decode(Frame.java:239)
at com.datastax.driver.core.Frame$Decoder.decode(Frame.java:205)
at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:387)
... 11 common frames omitted
この時点から、あなただけのタイムアウトを参照してくださいにし、再試行しますが、接続が再確立されません。
// CREATION OF CASSANDRA SESSION
PoolingOptions poolingOptions = new PoolingOptions();
poolingOptions
.setPoolTimeoutMillis(0)
.setMaxRequestsPerConnection(HostDistance.LOCAL, 32768)
.setMaxRequestsPerConnection(HostDistance.REMOTE, 2000);
cluster = builder.withPoolingOptions(poolingOptions).build();
cluster.getConfiguration().getCodecRegistry().register(new EnumNameCodec<>(OnBoardingSlide.Type.class));
session = cluster.connect(Global.getServerConfig().CASSANDRA_KEYSPACE_NAME);
あなたは挿入を行っていますか、または単にcassandraから読んでいますか? – root545
。すべてのクエリが失敗します。 – AvivC