Bringing together the Apache Cassandra experts from the community and DataStax.

Want to learn? Have a question? Want to share your expertise? You are in the right place!

Not sure where to begin? Getting Started

 

question

rikitavi93_191449 avatar image
rikitavi93_191449 asked ·

Why does num_tokens differ between Academy course DS210 and open-source Cassandra?

Hi


I've started the DS210: DataStax Enterprise 6 Operations course and downloaded both versions of Cassandra: DSE and regular one from Apache. Watching the topic "Configuring Clusters" I noticed num_token is 128 whereas if we look into cassandra.yaml of Apache its value is 256.

So, if I'm trying to pass the exam can this difference act on my exam ?

academyds210virtual nodes
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

Erick Ramirez avatar image
Erick Ramirez answered ·

The "default" number of tokens depends on which distribution of Cassandra you're using and whether you're comparing what's in cassandra.yaml versus the defaults in the source code. Allow me to explain.

Apache Cassandra

In open-source Cassandra, num_tokens is explicitly set to 256 in cassandra.yaml. This is true for both the latest C* 3.11.6 release and the current alpha release C* 4.0-alpha4:

num_tokens: 256

However if num_tokens is not set in cassandra.yaml, the number of tokens defaults to just 1 (see Config.java):

    public int num_tokens = 1;

DataStax Enterprise

The default cassandra.yaml that ships with DSE (for example, DSE 6.0) has num_tokens set to 128 but it is commented out so it has no effect during bootstrap:

# num_tokens: 128

Unless num_tokens is explicitly set, a new node will bootstrap with just 1 token.

Academy courses

The latest version of the courses are using DSE 6.0 so the defaults above apply.

In the exam, the answer will depend on the question you are asked. For example, if the question is "what is the default value of num_tokens set in the cassandra.yaml of open-source Cassandra?", the answer is 256. Cheers!

2 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Wow, such a detailed answer, thanks !

0 Likes 0 · ·

Not a problem! Good luck with the exam if you're taking it. Cheers!

0 Likes 0 · ·