Database Reference
In-Depth Information
initial_token
An initial_token is by default commented out. It is a pre-v1.2 setting when there was
no vnode and each machine was responsible for one row-key range. Unless, you have a
specific use case where you want each machine to have one range, or you are stuck with
pre-1.2 distribution, this is not recommended.
An initial_token is a number assigned to a node that decides the range of keys that it
will hold. A node holds token T(n-1) + 1 to Tn , where T(n-1) is the upper limit of the token
number that some nodes in the ring hold. In the ring diagram, we showed nodes with suc-
cessive ranges next to each other. For example, node (n-1) , n , and (n+1) is in an order, but
they may physically be far apart; maybe in different data centers. For more information,
refer to Chapter 2 , Cassandra Architecture .
In cassandra.yaml , you may insert an initial_token as follows:
initial_token: 85070591730234615865843651857942052864
It is important to choose initial tokens wisely to make sure the data is evenly distributed
across the cluster. If you do not assign initial tokens to the nodes at the start of a new
cluster, it may get automatically assigned, which may lead to a hotspot. However, adding a
new node is a relatively smart option. If you do not mention the initial_token to the
new node, Cassandra will take a node that is loaded the most number of times and assign
the new node a key that splits the token's own loaded node into half. It is possible to load
balance a running cluster, and this is fairly easy. We'll learn more about load balancing in
Chapter 6 , Managing a Cluster - Scaling, Node Repair, and Backup . The next logical ques-
tion is how to determine the initial_token for a node. It depends on the partitioner
that you are using. Basically, we divide the whole range of keys that the partitioner sup-
ports into N equal parts, where N is the total number of nodes in the cluster. Then, we as-
sign each node a number. We will see this in the next section.
Search WWH ::




Custom Search