|
When Cassandra receives a key for either a read or a write, the hash function is applied to the key to determine where it lies in the range. Since all nodes in the cluster are aware of the other nodes' ranges, any node can handle a request for any other node's range. The node receiving the request is called the coordinator, and any node can act in this role. If a key does not belong to the coordinator's range, it forwards the request to replicas in the correct range.
Following the previous example, we can now examine how our names might map to a hash, using the Murmur3 hash algorithm. Once the values are computed, they can be matched to the range of one of the nodes in the cluster, as follows:
————————————————————————————————————————————
Name Hash value Node assignment
————————————————————————————————————————————
John -3916187946103363496 3
————————————————————————————————————————————
Jane 4290246218330003133 5
————————————————————————————————————————————
George -7281444397324228783 2
————————————————————————————————————————————
Sue -8489302296308032607 2
———————————————————————————————————————————— |
|