Initial_token | In a Cassandra cluster, the Key/Value pairs are spread among all the nodes of the cluster. The entries are hashed (based on their key) using a consistent hashing algorithm that enables the entry to be associated to a specific node. For this and internally, there is a convention but to keep it simple, each node in the Cassandra cluster is assigned a token (called the initial_token) that gives you the entries that the node is responsible for.Each node has a defined token. When setting up a new cluster, the token is calculated (using a python script) and specifies the key range each node (ie. JVM) is responsible for.- This is a range between 0 and 2^127- Each node is responsible for a subpart of this integer space. Hence, each node is responsible for a range of keys.tApplication Director provides you a set of variables to use within scripts. Two of them will help us to calculate the token:- nodes_ips. This is the list of the IPs of the virtual machines in the cluster. For instance, if you want to deploy a 5 node cluster, Application Director will fill in this list with 5 IPs.- node_index. This is the index in the previous list of the current virtual machine. For instance, the index could be 3. So, the current VM is the third VM in the cluster. |