Redundancy in the Cassandra Database (Replication)

Source: Internet
Author: User
Tags cassandra

What is replication?

In Cassandra, replication is the storage of data to multiple nodes to ensure reliability and error tolerance. When you create a keyspace (equivalent to a table in a relational database), you must give a copy placement policy (Replica placement strategy)

What is a replica factor (Replica Factor)?

This number determines several copies, for example, if set to 1, it means that there is only one copy per line, and so on. All copies are equal, no master or subordinate. Note that the replica factor can not exceed the number of nodes, (not so many nodes let you put so many copies) otherwise write operations will be rejected.

What is a replica placement policy (Replica placement strategy)?

This strategy determines how a keyspace copy is placed in the cluster (specified when the keyspace is created)

A. Simple strategy (Simplestrategy):

The default copy placement policy when you create a keyspace using the Cassandra CLI command-line tool. Assuming that the first node is set to N1 according to Partitioner, its clockwise node is n2,n3 ... This strategy places the first copy of the keyspace on the N1, and then the other replicas are placed in n2,n3. On

More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/database/extra/

B. Network topology Strategy (NETWORKTOPOLOGYSTRATEGY):

This strategy is used when you know how the nodes are grouped in the data center or if you want to deploy the cluster across multiple data centers, at which point you must specify how many replicas each datacenter needs (typically set to 2 or 3). In this case, the replica placement policy is determined by the data center itself. Specifically, first by Partitioner decided that the first node set to N1, on the Shelf (RACK1), belonging to the data center DC1, then the first copy is placed in the N1, the other copies must be placed in the DC1, the priority is not rack1 shelves, if no other rack, Can only be placed on the rack1.

For example, as shown in the figure, there are now two data centers, Blue is DC1, green means DC2,DC1 2 shelves, respectively, Rack1 and Rack2. Then if the first node selected by Partitioner is the DC1 node N3, then the copy R1 is placed on DC1 node N3, and the next copy of the copy R2 is placed on the same DC, which is DC1 's next rack (if any), and it just finds that Clockwise next node N4 happens to be DC1, but it is another shelf (RACK2), so the copy R2 on the N4. The same strategy is followed for 2 replicas belonging to DC2.

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.