2. “ MongoDB (from "hu mongo us") is a scalable, high-performance, open source, schema-free, document-oriented database.” - mongodb.org Created by 10gen
3.
4.
5.
6.
7.
8. SQL Statement Mongo Query Language Statement CREATE TABLE USERS (a Number, b Number); implicit; can be done explicitly INSERT INTO USERS VALUES(1,1); db.users.insert({a:1,b:1}) SELECT * FROM users; db.users.find() SELECT * FROM users WHERE age=33; db.users.find({age:33}) SELECT * FROM users WHERE age=33 ORDER BY name; db.users.find({age:33}).sort({name:1}) SELECT * FROM users WHERE age>33; db.users.find({'age':{$gt:33}}) SELECT * FROM users WHERE age<33; db.users.find({'age':{$lt:33}})
10. Sharding Sharding is the partitioning of data among multiple machines in an order-preserving manner . SHARDING IN MONGODB: Auto –Sharding (only needs shard key ). Automatic load Balancing. Scaling out to thousands of nodes. Availability and automated failover
17. Flowchart App Server Client (Mongos) Configuration Server DECISION Global Targeted Shard3 Shard4 Shard2 Shard1
18. Sharding and Failover NO SINGLE POINT FAILURE Failure of ->Mongos process ->Single mongod server ->Failure of all mongod servers comprising a shard. ->Config server.
26. Election Algorithm Periodically exchange Maxappliedoptime with all other nodes using the following format (selfid,maxoptime) . If nodes maxoptime is more send NO or else send YES(Arbitrer). The node getting the majority of yes and see majority of nodes will be elected as Primary . The process is repeated periodically.