A distributed model of NoSQL database

Source: Internet
Author: User
Tags redis cluster

A distributed model of a NoSQL database single server

When a server is fully competent to work, there is no need to consider the distribution, so the deployment is simple, maintenance is much more convenient;

Shard Features

The various parts of the data are stored in different servers in the cluster;
For example, according to the letter: the key values starting with A-G are stored on the first server, with the h-n beginning of the storage to the second ...

Issues to consider
    • How to store data so that users can basically just get data from a single server
      If it is often necessary to interact with multiple nodes to fetch the required data, the fragmentation policy may not be appropriate, or the Shard in the scenario is not an ideal scenario;

    • Distribution of data nodes: The relationship between geographic location and access users
      Data nodes are distributed around the world, so that users in Beijing can access the required data only by visiting Beijing's nodes.

    • Maintain load Balancing

Advantages
    • Improves read and write performance at the same time
      Since sharding is the distribution of data to multiple node stores, the pressure is equally dispersed at the time of writing;

    • Scale-out write capability

Disadvantages

Reduce Database error Resilience
After fragmentation, the failure of nodes in the cluster will result in some data loss;
Solution: Each shard data is not only stored on a single node, redundant storage, increased data security (by the later described in conjunction with master-slave replication, is a common means)

Master-Slave replication features

The master node holds authoritative data and is responsible for the data update operation;
The master node copies the updated data to the slave node;

Advantages
    • Helps improve data read performance
      Only query from node, increase data read performance from node.

    • Enhanced failure recovery of read operations
      The primary node is corrupt and the read request can still be processed;
      Update requests can be processed after upgrading from nodes to primary nodes;

    • Single storage Solution for "one-off" instant backup
      Even if distributed deployment is not required, master-slave replication can be used as a single-server backup deployment scenario;

Disadvantages
    • Inconsistencies in data (not updated in time)
      After the master node is updated, the data synchronized to each slave node is not guaranteed to be timely and may result in inconsistent data on each node (with eventual consistency)

    • Not very helpful for improving write performance
      All update operations are handled through the main node, and the use of master-slave replication model has little advantage for frequently updated business.

    • The primary node is the bottleneck and weakness of the system

Peer replication Features

All nodes have the same status and can receive queries and write requests;
Each node copies its own updated data to the other nodes;

Advantages
    • Gracefully handle faulty nodes without worrying about loss of data requests
    • Increase the node and easily improve query and write performance
Disadvantages
    • Data inconsistency
      There is a possibility of conflict between writing and reading;
Combined use

One-drag-and-drop scheme in sharding and master-slave replication is used together;
The function of sharding is the distributed storage of data, and the function of master-slave replication is to provide backup for each shard node and increase data security.

Note: The deployment of the Sina Redis cluster uses this scheme, and the use of Sina Redis is described in the blog before the big cc:
The application of Redis in Sina Weibo

Attached Mind Map

Reference

The essence of NoSQL

Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

A distributed model of NoSQL database

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.