gpt4 book ai didi

java - 不支持的带有 Amazon Keyspaces 的分区器(适用于 Apache Cassandra)

转载 作者:行者123 更新时间:2023-12-04 10:12:30 27 4
gpt4 key购买 nike

我有一个 Java Spring 应用程序,我正在使用 Amazon Keyspaces (for Apache Cassandra) .我正在使用 sigv4 plugin 、(版本 4.0.2)、cassandra java-driver-core(版本 4.4.0),并遵循了关于如何将我的 java 应用程序与 MCS 连接的官方文档。该应用程序连接正常,但我在启动时收到一个奇怪的警告:

WARN 1 --- [     s0-admin-0] .o.d.i.c.m.t.DefaultTokenFactoryRegistry : [s0] Unsupported partitioner 'com.amazonaws.cassandra.DefaultPartitioner', token map will be empty.

一切看起来都不错,但几分钟后警告又回来了,我的查询开始失败。这是几分钟后日志的样子:
WARN 1 --- [     s0-admin-0] .o.d.i.c.m.t.DefaultTokenFactoryRegistry : [s0] Unsupported partitioner 'com.amazonaws.cassandra.DefaultPartitioner', token map will be empty.
WARN 1 --- [ s0-io-1] c.d.o.d.i.c.m.SchemaAgreementChecker : [s0] Unknown peer xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, excluding from schema agreement check
WARN 1 --- [ s0-io-0] c.d.o.d.i.c.control.ControlConnection : [s0] Unexpected error while refreshing schema after a successful reconnection, keeping previous version (CompletionException: com.datastax.oss.driver.api.core.connection.ClosedConnectionException: Channel was force-closed)
WARN 1 --- [ s0-io-1] c.d.o.d.i.c.m.DefaultTopologyMonitor : [s0] Control node ec2-x-xx-xxx-xx.us-east-2.compute.amazonaws.com/x.xx.xxx.xxx:xxxx has an entry for itself in system.peers: this entry will be ignored. This is likely due to a misconfiguration; please verify your rpc_address configuration in cassandra.yaml on all nodes in your cluster.

我已经调试了一点,看起来分区器来自实际的节点元数据,所以我真的不知道是否有实际的方法来修复它。

我看到最近有人问过类似的问题 here ,但尚未发布任何解决方案。有任何想法吗?非常感谢提前

最佳答案

和我一样的问题。
enter image description here
使用时遇到的上述问题Spring 启动版本 2.3.x
因为是 Spring 启动版本 2.3.x

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra-reactive</artifactId>
</dependency>

OR

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-cassandra</artifactId>
</dependency>
创建 Maven/Gradle 时会得到 “datastax-java-driver-core 4.6.1”我认为这是 Amazon Keyspaces 的另一个原因不支持。
enter image description here

Okay, Clear.....


回到AWS库的主题 aws-sigv4-auth-cassandra-java-driver-plugin 4.0.2
创建 Maven/Gradle 时会得到 “datastax-java-driver-core 4.4.0”
enter image description here
现在我开始看到 Amazon Keyspaces
可能不支持 “datastax-java-driver-core”与版本 大于 4.4.0

Okay, it's been very long.



If you want Application Spring Boot 2 to work



您尝试按照以下解决方案进行操作。
pom.xml
  • 删除 aws-sigv4-auth-cassandra-java-driver-plugin
  • 降级 Spring boot 版本 2.3.x 2.2.9
  • 在下面添加依赖项,

  • spring-boot-starter-data- cassandra-reactive
    或者
    spring-boot-starter-data- Cassandra
  • 创建亚马逊数字证书并下载
  • 如果您使用 InteljiJ IDEA 编辑配置

  • enter image description here
    转到 编辑配置 -> 下一个 虚拟机选项 在下面添加,
    -Djavax.net.ssl.trustStore=path_to_file/cassandra_truststore.jks 

    -Djavax.net.ssl.trustStorePassword=my_password
    enter image description here
    引用: https://docs.aws.amazon.com/keyspaces/latest/devguide/using_java_driver.html
  • application-dev.yml 在下面添加配置,
  • spring:
    data:
    cassandra:
    contact-points:
    - "cassandra.ap-southeast-1.amazonaws.com"
    port: 9142
    ssl: true
    username: "cassandra-username"
    password: "cassandra-password"
    keyspace-name: keyspace-name
    request:
    consistency: local_quorum
  • 运行测试程序

  • enter image description here
    enter image description here

    Pass.


    为我工作。
    技术栈
  • Spring Boot WebFlux 2.2.9.RELEASE
  • Cassandra 响应式(Reactive)
  • JDK 13
  • 带有 Amazon Keyspaces 的 Cassandra 数据库
  • Maven 3.6.3

  • 玩得开心编程。

    关于java - 不支持的带有 Amazon Keyspaces 的分区器(适用于 Apache Cassandra),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61263314/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com