skip to Main Content

After update my Cassandra docker container it raised the following error:

CassandraDaemon.java:911 – Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: Cannot change the number of tokens from 256 to 16

I am using cassandra:latest image, and probably its updated its version, and after that the server shutdown every time I try to run it again. Any thoughts?

2

Answers


  1. Cassandra allow the min token number is 256, so just modify num_tokens to 256 or higher value in cassandra.yaml, then restart Cassandra

    Login or Signup to reply.
  2. The user asked the same question on https://community.datastax.com/questions/13536/ and I’m re-posting my answer here.


    We do not recommend updating a Cassandra container to a newer version. Cassandra 4.0+ is pre-configured with a new default of 16 virtual nodes (CASSANDRA-13701):

    num_tokens: 16
    

    Older versions of Cassandra had a default of 256. It is not possible to change the number of tokens allocated to a node once Cassandra has joined a cluster (even for single-node clusters). As you have already discovered, changing the allocated tokens will prevent Cassandra from starting.

    You will need to edit the cassandra.yaml in order to allow Cassandra to start. Provided you named your container cassandra:

    $ docker ps -a
    CONTAINER ID  IMAGE      COMMAND  CREATED  STATUS  PORTS              NAMES
    788db79a03d3  cassandra  ...      ...      Up      7000-7001/tcp,...  cassandra
    

    you can view the cassandra container’s configuration with:

    $ docker inspect cassandra
    

    and you will see that the configuration directory is set to:

                    "CASSANDRA_CONF=/etc/cassandra",
    

    Make a local copy of the configuration file:

    $ docker cp cassandra:/etc/cassandra/cassandra.yaml .
    

    Edit your local copy then copy the modified version to the the container with:

    $ docker cp cassandra.yaml cassandra:/etc/cassandra/cassandra.yaml
    

    Cheers!

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search