Module 7 - NoSQL
Module 7 - NoSQL
NoSQL
If this is the case, then the distributed system designer would have
to choose two properties out of the three to guarantee.
Replication in MongoDB
The concept of replica set is used in MongoDB to
createmultiple copies of the same data set on different
nodes in the distributed system
It uses a variation of the master-slave approach - all
write operations must be applied to the primary copy
and then propagated to the secondaries
MongoDB Distributed Systems Characteristics
Sharding in MongoDB
Sharding of the documents in the collection—also known as
horizontal partitioning— divides the documents into disjoint
partitions known as shards.
This allows the system to add more nodes as needed by a
process known as horizontal scaling of the distributed
system
It store the shards of the collection on different nodes to
achieve load balancing
Each node will process only those operations pertaining to
the documents in the shard stored at that node
MongoDB Distributed Systems Characteristics
Two ways to partition a collection into shards – range
partitioning and hash partitioning
Both require that the user specify a particular document field to
be used as the basis for partitioning the documents into shards.
The partitioning field, known as the shard key must have two
characteristics:
it must exist in every document in the collection
it must have an index
Range partitioning creates the chunks by specifying a range of key
values
Hash partitioning applies a hash function h(K) to each shard key
K, and the partitioning of keys into chunks is based on the hash
values
MongoDB Distributed Systems Characteristics
When sharding is used, MongoDB queries are submitted to a
module called the query router, which keeps track of which
nodes contain which shards based on the particular
partitioning method used on the shard keys
The value is the data item itself, and it can have very
different formats for different key-value storage systems
Thus, the primary key is the key and the item is the value
for the DynamoDB key-value store