【问题标题】:Spring boot [s0] Error connecting to Node(endPoint=127.0.0.1:9042, hostId=null,>Spring boot [s0] 连接到节点时出错(endPoint=127.0.0.1:9042,hostId=null,>
【发布时间】:2021-08-02 09:42:49
【问题描述】:

我有一个 Spring Boot 的应用程序,使用 Cassandra DB 4.0,运行到带有 java 1.8_292 的 ubuntu 16.0。

当我启动 tomcat 9 时,catalina.out 日志中出现以下消息:

> 2021-05-11 22:57:49.614  WARN 1184 --- [s0-admin-1] c.d.o.d.i.c.control.ControlConnection: [s0] Error connecting to Node(endPoint=127.0.0.1:9042, hostId=null, 
> 2021-05-11 22:57:49.628  WARN 1184 --- [ main] ConfigServletWebServerApplicationContext: Exception encountered during context initialization - cancelling re
> 2021-05-11 22:57:49.645  INFO 1184 --- [main] ConditionEvaluationReportLoggingListener: Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled. 
> 2021-05-11 22:57:49.692 ERROR 1184 --- [main] o.s.boot.SpringApplication : Application run failed

我检查了,CQLSH 6 运行正确:

Connected to SSP at 127.0.0.1:9042
[cqlsh 6.0.0 | Cassandra 4.0 | CQL spec 3.4.5 | Native protocol v5]
Use HELP for help.
cqlsh>

nodetool状态正常:

Datacenter: datacenter1
=======================
Status=Up/Down
|/ State=Normal/Leaving/Joining/Moving
--  Address    Load        Tokens  Owns (effective)  Host ID                               Rack
UN  127.0.0.1  414.45 KiB  16      100.0%            f457b508-1b91-456c-85bc-1a621c5c1d78  rack1

但是 spring boot 无法连接到 Cassandra。它给了我这个错误 [s0] Error connected to Node(endPoint=127.0.0.1:9042, hostId=null, .

cassandra.yaml 和 cassandra-env.sh 默认配置为 127.0.0.1。

有人知道发生了什么吗?

Pom.xml

        <!-- https://mvnrepository.com/artifact/com.datastax.cassandra/cassandra-driver-core -->
        <dependency>
            <groupId>com.datastax.cassandra</groupId>
            <artifactId>cassandra-driver-core</artifactId>
            <version>4.0.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/com.datastax.spark/spark-cassandra-connector -->
        <dependency>
            <groupId>com.datastax.spark</groupId>
            <artifactId>spark-cassandra-connector_2.12</artifactId>
            <version>3.0.0</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.spark/spark-core -->
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.12</artifactId>
            <version>3.1.1</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.spark/spark-sql -->
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-sql_2.12</artifactId>
            <version>3.1.1</version>
        </dependency>

【问题讨论】:

  • cassandra-driver-core 升级到最新版本,而不是非常旧的 4.0.0。如果您不需要,也排除 spark-cassandra-connector 和 spark 依赖项
  • 感谢亚历克斯·奥特的回复!我升级了 {Cassandra-driver-core}。我在项目中需要的 Spark 依赖项。但是错误不断。这个应用程序在 5 个月时在 CentOs 7 中运行得非常好。我们需要更改为 Ubuntu 并出现此错误。我不明白,为什么会这样。你能有其他建议吗?
  • 也许您的节点上有防火墙?虽然通常它不应该处理本地主机流量
  • 我会检查的。这种新环境位于 AWS 云 EC2 中。我不知道它会干扰本地主机流量。
  • @AlexOtt,这是同样的问题stackoverflow.com/questions/67526050/… 吗?

标签: java spring-boot ubuntu tomcat cassandra


【解决方案1】:

这是一个 Cassandra 问题。将 datastax/driver-java 的版本增加到 4.11.1。这个版本修复了真正的问题:意外失败(java.lang.IllegalArgumentException: Unsupported request opcode: 0 in protocol 6)。

更多详情:

https://issues.apache.org/jira/browse/CASSANDRA-16636?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel

https://datastax-oss.atlassian.net/browse/JAVA-2936

【讨论】:

    猜你喜欢
    • 2021-03-31
    • 1970-01-01
    • 2018-10-23
    • 2015-11-07
    • 2017-04-11
    • 2017-09-26
    • 2020-08-16
    • 2021-07-19
    • 1970-01-01
    相关资源
    最近更新 更多