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
Cassandra allow the min token number is 256, so just modify num_tokens to 256 or higher value in cassandra.yaml, then restart Cassandra
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):
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 containercassandra
:you can view the cassandra container’s configuration with:
and you will see that the configuration directory is set to:
Make a local copy of the configuration file:
Edit your local copy then copy the modified version to the the container with:
Cheers!