简体   繁体   中英

Unsupported partitioner with Amazon Keyspaces (for Apache Cassandra)

I have a Java Spring app and I'm using Amazon Keyspaces (for Apache Cassandra) . I'm using the sigv4 plugin , (version 4.0.2), the cassandra java-driver-core (version 4.4.0) and have followed the official documentation on how to connect my java app with MCS. The app connects just fine but I'm getting a weird warning at start up:

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

Everything looks good but after a few minutes that warning comes back and my queries start to fail. This is how the logs look after a few minutes:

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.

I have debugged a little and it looks like that partitioner comes from the actual node metadata, so I don't really know if there's an actual way to fix it.

I've seen there's a similar question asked recently here , but no solution has been posted yet. Any ideas? Thanks so much in advance

Problem the same with me.

在此处输入图像描述

The above problems encountered when using a Spring boot version 2.3.x

Because is a Spring boot version 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> 

When creating a Maven / Gradle will get "datastax-java-driver-core 4.6.1" and I think this is another reason that Amazon Keyspaces are not supported.

在此处输入图像描述

Okay, Clear.....

Back to the subject of AWS library aws-sigv4-auth-cassandra-java-driver-plugin 4.0.2

When creating a Maven / Gradle will get "datastax-java-driver-core 4.4.0"

在此处输入图像描述

Now I am starting to see that Amazon Keyspaces

Maybe not supported "datastax-java-driver-core" with version greater than 4.4.0

Okay, it's been very long.

If you want Application Spring Boot 2 to work

You try following the solutions follows.

look at pom.xml

  1. remove aws-sigv4-auth-cassandra-java-driver-plugin

  2. downgrade Spring boot version 2.3.x to 2.2.9

  3. add dependency below,

spring-boot-starter-data- cassandra-reactive OR spring-boot-starter-data- cassandra

  1. create Amazon digital certificate and download

  2. If you used InteljiJ IDEA Edit Configurations

在此处输入图像描述

Goto Edit Configurations -> next VM Options add below,

-Djavax.net.ssl.trustStore=path_to_file/cassandra_truststore.jks 

-Djavax.net.ssl.trustStorePassword=my_password

在此处输入图像描述

Reference: https://docs.aws.amazon.com/keyspaces/latest/devguide/using_java_driver.html

  1. application-dev.yml add config below,
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
  1. Run Test Program

在此处输入图像描述 在此处输入图像描述

Pass.

Work for me.

Tech Stack

  • Spring Boot WebFlux 2.2.9.RELEASE
  • Cassandra Reactive
  • JDK 13
  • Cassandra Database with Amazon Keyspaces
  • Maven 3.6.3

Have fun with programming.

These are all warnings and not errors. Your connection should work just fine. They are logged due to how Amazon Keyspaces is slightly different from an actual Cassandra cluster. Try setting these to get rid of the noise:

datastax-java-driver.advanced {
  metadata {
    schema.enabled = false
    token-map.enabled = false
  }
  connection.warn-on-init-error = false
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM