Database Reference
In-Depth Information
Cluster Setup
Simply installing the package and running Cassandra will run a single-node
cluster. The default configuration options will all be suitable with the exception of
listen_address , which needs to be changed from localhost in order to take
external connections.
Multinode clusters are slightly more complex to set up as the new nodes need
to know about the existing nodes in the cluster. New Cassandra nodes discover in-
formation about the other nodes via a protocol called Gossip. To get everything
working correctly, we will need to modify a few of the configuration options to
ensure that Gossip will be able to communicate properly and to ensure that your
data is distributed properly.
When bringing a new node into the cluster, you must specify a “seed node.”
The seed nodes are a set of nodes that are used to give information about the
cluster to newly joining nodes. The seed nodes should be stable and should also
point to other seed nodes; that is, there should be no single seed node that will
point to itself as the seed node. The seed nodes are specified in the partition-
er section of the configuration file.
The second option to specify is the initial_token . A token represents a
node's place in the cluster, as well as how much data that node is supposed to
own. The token is a number between 0 and (2 127 -1). This initial token is used
only the first time the node boots, after which you will need to use nodetool
move to change the token. In most situations, you will want to have a balanced
cluster, where every node owns the same amount of data. When creating a bal-
anced cluster, the formula to create the tokens is 2 ^127 / K * N , where K is the total
number of nodes in the cluster and N is the number of the nodes you are calculat-
ing for based on a zero index. Listing 2.1 shows pseudo code representing how to
generate tokens for a six-node cluster.
Listing 2.1 Pseudo Code to Print Out Even Tokens in a Six-Node Cluster
Click here to view code image
NODES=6
for each n in 0 to NODES :
token = 2^127 / NODES * n
print token
 
Search WWH ::




Custom Search