com.datastax.driver.core.exceptions.InvalidQueryException: 未配置 table peers_v2

com.datastax.driver.core.exceptions.InvalidQueryException: unconfigured table peers_v2

我正在开发一个应用程序 Spring Boot 连接到 cassandra

这是我的连接设置

spring.data.cassandra.contact-points=localhost
spring.data.cassandra.keyspace-name=sa_tas_db_cassandra
spring.data.cassandra.schema-action=create_if_not_exists
spring.data.cassandra.username=cassandra

我只是在使用 table,它是我通过模型创建的。以下是哪个

import org.springframework.data.cassandra.core.mapping.PrimaryKey
import org.springframework.data.cassandra.core.mapping.Table
import java.time.LocalTime
import java.util.*

@Table
data class CallLog(
    @PrimaryKey
    val callId:UUID,
    val CustomerUsername: String? = null,
    val callDirection: String? = null,
    val callingPartyName:String? = null,
    val callingPartyNumber:String? = null,
    val calledPartyNumber:String? = null,
    val typeOfCall:String? = null,
    val startTime: Date? = null,
    val answerTime: LocalTime? = null,
    val disconnectTime:Date? = null,
    val timeCallForwarded: Date? = null,
    val voicemailSystemAccessNumber:String? = null
)

这就是我的所有 cassandra 设置

我也在用新的 relic 监控我的应用程序,它产生了以下问题

….netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:99)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
….channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
  io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:286)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
….channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
…etty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
….channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
…tty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:321)
…o.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:295)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
….channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
…netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:93)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
….channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:355)
…channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:377)
…hannel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:363)
…o.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
….channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
   io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:714)
….channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:650)
  io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:576)
                  io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
….netty.util.concurrent.SingleThreadEventExecutor.run(SingleThreadEventExecutor.java:989)
         io.netty.util.internal.ThreadExecutorMap.run(ThreadExecutorMap.java:74)
   io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)

这个错误不影响应用程序的运行,它只影响性能

谢谢

这是支持 Cassandra 4.0 的兼容性测试的一部分,它以不同的名称将有关集群中节点的信息存储在 table 中,因此驱动程序首先假定它针对较新版本运行,并检查此 table,如果收到错误,则使用旧的 peers table。仅从版本号不可能可靠地检测 Cassandra 节点的功能,这就是为什么最好明确检查 table。

对应的代码是here.