Mongodb basics and architecture

4,522 views 36 slides Jul 24, 2018
Slide 1
Slide 1 of 36
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36

About This Presentation

Simple introduction to mongodb and its basic architecture.


Slide Content

mongo DB

Written in: C++ Data model: uses BSON (binary JSON), lightweight, traversable, efficient Based on ‘document model’ Use NoSQL (not only SQL), SQL is used for RDBMS Retains some friendly properties of SQL License: AGPL ( Drivers:Apache )

Why?

Why?

Why?

Why?

Why?

Why?

Why?

Drawbacks of such complexity Hard to understand Hard to add features Inefficient

Imagine this was done in real world

Imagine this was done in real world

Imagine this was done in real world

Imagine this was done in real world

mongoDB takes entirely different approach Here, Data is stored in records (called as documents) Separate documents for each patient (example)

Illustration using Previous example

Illustration using Previous example

Illustration using Previous example

Illustration using Previous example

Hence, Efficient for computer to process Natural and easy for humans to read They can adapt

MongoDB terminology Databases Collections (Table in RDBMS) Documents (Tuple/Rows in RDBMS)

MongoDB Distributed Systems Architecture Replication Sets Single-master! Maintains backup copies of database instance Secondaries can elect a new primary within seconds if primary goes down

Architecture Replica Set Quirks Replicas only address durability, not ability to scale A majority of the servers in your set must agree on the primary Even number of servers (2) does not work

Architecture Write process All write operation go through primary, which applies the write operation. Write operation then records operations on primary’s operation log “ oplog ” Secondary are continuously replicating the oplog and applying the operations to themselves in an asynchronous process

Architecture Workloads Isolation Combines different classes of workload

Architecture Sharding To meet the needs of app with large data sets and high throughput requirements

Architecture Sharding Mongos talks to exactly three Config server

Architecture Sharding Quirks If any one config serves goes down, your entire database goes down. Auto- sharding sometimes doesn’t work.

Architecture Data Locality MongoDB zoned sharding allows precise control over where data is physically stored in a cluster. Enables developers- data placement by geographic region Developer can assign each shard to a zone representing the physical location. Any number of shards can be associated with each zone, and each zone can be scaled independently of the other

Architecture Data Security Authentication Offers integration with external security mechanisms including Windows Active Directory, Kerberos, etc. Authorization Enable to configure granular permission for user Auditing provide native audit log to track any DB operations Encryption On networks, on disk and in backups

Architecture Freedom to Run Anywhere Many companies moving to public cloud MongoDB allows organizations to adopt cloud at their own pace by moving select workloads as needed. For example, They may run the same workload in a hybrid environment to manage sudden peaks in demand, or use the cloud to launch services in regions where they lack a physical data center presence.

Advantages over RDBMS Schema less Deep query ability Ease of scale-out Structure of single object is clear Uses internal memory for storing the working set, enabling faster access of data Mapping of application objects to database objects is not needed

Why use MongoDB? Document Oriented Storage Index on any attribute Replication and high availability Auto- sharding Rich queries Built-in aggregation capabilities, MapReduce, GridFS Professional support by MongoDB

Where to use MongoDB? Big Data Content Management and Delivery Mobile and Social infrastructure User Data Management Data Hub

References- https:// www.mongodb.com/what-is-mongodb Mongodb A rchitectural Guide https ://www.tutorialspoint.com/mongodb / MongoDB Tutorials – TutorialsPoints Understanding mongodb , by Frank Kane - Youtube video MongoDB in 5 minutes with Eliot Horowitz – Youtube video

Thank You