Cassandra the link between several 3 concepts of data distribution

Source: Internet
Author: User
Tags cassandra

Description: This article is based on the Cassandra1.2.0 version.

In Cassandra, there are some concepts of data center, frame, virtual node, replica, replica strategy, and partitioning device in the data distribution, which are inseparable, sometimes confusing and difficult to understand. Today I would like to make a summary, I hope to play a role in the discussion, welcome.

Network topology structure

In order to facilitate the future expansion of Cassandra, the general will be equipped with data center and rack induction mode. A simpler architecture diagram can be shown below.

The gray section above means that the network topology is configured by Cassandra-topology.properties (and, of course, by IP). If you want this configuration to take effect, you also need to modify Endpoint_snitch to Propertyfilesnitch in Cassandra.yaml.

Virtual node

The benefits of using virtual nodes can be referenced here. The virtual node is not configured in the cassandra1.2.0 configuration and needs to be removed from the comments in Cassandra.yaml before num_tokens:256.

In a cluster of Cassandra's multiple data centers, the data in each datacenter is exactly the same. The virtual nodes of all nodes in a single data center are randomly distributed across the Hashi. If 1 data centers have 2 nodes, and the virtual node of each node is 256, then the Hashi will be divided into 512 parts on average. Each copy is also called a hash range. The hash range for each node virtual node is not contiguous.

Replica related

Each of the data in the Cassandra is called a copy, and the copy is not primary or secondary, equally important. The copy and copy strategy for the data is for keyspace, that is, how many copies of a piece of data are available to be configured through the keyspace to which it belongs. As in the following paragraph:

CREATE keyspace cltest with
     placement_strategy = ' org.apache.cassandra.locator.NetworkTopologyStrategy '
     and Strategy_options = {' DC1 ': 2, ' DC2 ': 2}
Here Cltest uses a replica policy of networktopologystrategy, a replica factor of 4, 2 copies of two data centers, and a different number of copies per datacenter.
So how does the data we store correspond to the corresponding virtual nodes? This is the partition device.

Partition Device

We store the data will have a key, stored when the partition to the key hash after the hash value (this hash value must be Hashi), and then according to this hash value to find the corresponding sequence range, also found the virtual node. Recommended use of Murmur3partitioner. The partitioning device is configured in the Cassandra.yaml file partitioner.


Summary: This paper describes the Cassandra data distribution of several large concepts, which are not too explicit in the contact text, in fact, is shown in the article from the big to the small relationship.


Cassandra Data Distribution series articles: Cassandra Data distribution 1 data centers and racks Cassandra Data distribution and replicas the link between the 3 concepts of Cassandra Data distribution Cassandra Data distribution of 4 rack induction Cassandra Data distribution of 5 partition device Cassandra Data Distribution test

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.