2

I installed Cassandra on MacOs using brew: brew install cassandra and ran it successfully cassandra -f.

After upgrading to MacOs Big Sur cassandra fails to start with this error:

Cannot change the number of tokens from 512 to 256
Fatal configuration error; unable to start server.  See log for stacktrace.
ERROR [main] 2021-01-05 11:53:34,647 CassandraDaemon.java:803 - Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: Cannot change the number of tokens from 512 to 256
    at org.apache.cassandra.service.StorageService.joinTokenRing(StorageService.java:1050) ~[apache-cassandra-3.11.9.jar:3.11.9]
    at org.apache.cassandra.service.StorageService.initServer(StorageService.java:732) ~[apache-cassandra-3.11.9.jar:3.11.9]
    at org.apache.cassandra.service.StorageService.initServer(StorageService.java:666) ~[apache-cassandra-3.11.9.jar:3.11.9]
    at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:395) [apache-cassandra-3.11.9.jar:3.11.9]
    at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:633) [apache-cassandra-3.11.9.jar:3.11.9]
    at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:786) [apache-cassandra-3.11.9.jar:3.11.9]
INFO  [StorageServiceShutdownHook] 2021-01-05 11:53:34,649 HintsService.java:209 - Paused hints dispatch
INFO  [StorageServiceShutdownHook] 2021-01-05 11:53:34,649 Gossiper.java:1662 - Announcing shutdown
INFO  [StorageServiceShutdownHook] 2021-01-05 11:53:34,657 StorageService.java:2408 - Node localhost/127.0.0.1 state jump to shutdown
INFO  [StorageServiceShutdownHook] 2021-01-05 11:53:36,663 MessagingService.java:985 - Waiting for messaging service to quiesce
INFO  [ACCEPT-localhost/127.0.0.1] 2021-01-05 11:53:36,665 MessagingService.java:1346 - MessagingService has terminated the accept() thread
INFO  [StorageServiceShutdownHook] 2021-01-05 11:53:36,745 HintsService.java:209 - Paused hints dispatch

First I tried uninstalling Cassandra via brew, deleting the remaining files: rm -rf /usr/local/etc/cassandra and reinstalling it with brew. This didn't help.

I found this link with complex support issues which rely on finding out where Cassandra config lies and a lot of reading about what are tokens in a cassandra context. It seems a bit extreme for an automatic development environment.

How do I install Cassandra on MacOs Big Sur? Is there a quick fix

Rubber Duck
  • 3,673
  • 3
  • 40
  • 59
  • Sounds like the upgrade somehow invoked brew and reinstalled the original cassandra.yaml file. Also, 512 tokens is WAY too many for Cassandra 3+. I wouldn't go higher than 16. – Aaron Jan 05 '21 at 13:32
  • @Aaron can you concisely explain tokens and explain how changing token number to 512 fixed the crash? – Rubber Duck Jan 05 '21 at 15:24
  • For explaining Tokens and the rationale for setting it less than 16, check out this article by Jon Haddad (https://thelastpickle.com/blog/2019/01/30/new-cluster-recommendations.html) and my answer to this question: https://stackoverflow.com/questions/25379457/what-is-virtual-nodes-and-how-it-is-helping-during-partitioning-in-cassandra/25384780#25384780 – Aaron Jan 05 '21 at 17:05
  • Changing the number to 512 fixed the problem, because you can't change `num_tokens` on an existing cluster. So when your yaml got set back to 256, it broke the Cassandra instance. – Aaron Jan 05 '21 at 17:06
  • @Aaron do you mean to say that this configuration is in more than one place? or perhaps that stoping the cluster isn't enough? how do I reset to a better number of tokens? (It's just for development) – Rubber Duck Jan 05 '21 at 17:15
  • No, I mean to say that the default location was likely being overwritten. Unfortunately, changing `num_tokens` cannot be done without reloading your data. But if it's just development on your own, single machine, it should be fine. The real problems happen when a cluster scales and has to stream data. – Aaron Jan 06 '21 at 13:39
  • @Aaron please write down how was something changed if I installed it cleanly using brew? And for the Non Cassandra admins among us exactly how to stop the service and where to configure. – Rubber Duck Jan 06 '21 at 16:50

1 Answers1

0

On a hunch I followed part of the instructions in the link and at '/usr/local/etc/cassandra' replaced num_tokens property value from 256 to 512 and it seems to work. Please post a better answer or point to a fix on brew

Rubber Duck
  • 3,673
  • 3
  • 40
  • 59