Cassandra how the database handles client requests

Source: Internet
Author: User
Tags cassandra

All nodes in the Cassandra cluster are peers, so read/write operations can occur on any node in the cluster, and perhaps this node does not require read/write data, so the node that interacts with the user becomes the coordinator node.

Write request for single data center:

When the client is sent to the coordinator node, the coordinator node sends the write request to all nodes in the cluster that have a replica of the target row (target node), such as:

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

In this example, the client sends the request to N10, but the N10 does not have the target row, so N10 is the coordinator node, which knows that the target line has 3 copies R1,r2,r3, followed by n1,n2,n7, so it writes requests to the 3 nodes. If there is an I successful response returned to N10 (I depends on the value of the consistency level configuration), N10 considers the write operation completed successfully, thus returning the response message to the client.

Write requests from multiple data centers:

In multiple data centers, in order to optimize performance, the Cassandra Cluster will find a coordinator in each datacenter, and then the Coordinator is responsible for the write operations of multiple replica nodes in the data center where they reside.

For example, in this example, DC1 's coordinator is N10,DC2 coordinator is also N10, then the client simply sends the write request to these 2 coordinator to be possible.

Read Request:

or find Coordinator,coordinator. A node "direct read" request sent to the consistency level number to return the result to the client, while the node "read repair" request sent to the other replica is used to synchronize the data.

In this case, for example, if there are 3 copies, but the consistency level is set to 2, coordinator will send a "direct read" request to two nodes (such as R1 and R3), while in the background, a "read fix" request will be sent to a third node (for example, R2)

This article from the "Cohesion of parallel Lines" blog, please be sure to retain this source http://supercharles888.blog.51cto.com/609344/865657

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.