Mongo db ç°»‹

  • View
    1.002

  • Download
    1

Embed Size (px)

Text of Mongo db ç°»‹

  • 1. Mongo DB

2. What is NoSQLWhy NoSQL MongoDB Introduction MongoDB HA MongoDB C# Driver MongoDB Install & Setup 3. What is NoSQLWhy NoSQL MongoDB Introduction MongoDB HA MongoDB C# Driver MongoDB Install & Setup 4. Relational Database 0 LockACID 0 Query cacheTable 0 Shema 0 0 IO 0 0 5. RDB+Memcached 0 Server 0 IO 0 0 0 Memcached 6. Memcached(1/3) 7. Memcached(2/3) MemcachedMemcachedMemcached 8. Memcached(3/3) 0 0 0 Name-Value Pair 0 Key 250 characters 0 1 megabyte 0 0 9. NoSQL(1/6) 0 Relation DBACID 0 0 0 Cachetable 0 Schemaschema 0 0 SQL 0 Transaction 10. NoSQL(2/6) 0 0 EX:LOG 0 NoSQL 0 MapReduce 0 0 NoSQLACID 0 0 SQLsolution 11. NoSQL(3/6) NoSQL DBDoucument MongoDB(10 gen) CouchDB(Apache) JSONDocument RDBRowHbase(Hadoop) row Cassandra(Facebook) Hypertable IOKey-ValueRedis(VMware) Flare(green.jp) SimpleDB(Amazon) GraphNeo4J FlockDB(Twitter) 12. NoSQL(4/6) 0 RDB? 0 NoSQL vs. RDB 0 0 0 0 NoSQL+RDB 0 NoSQL 0 0 InsertUpdate 0 13. NoSQL(5/6) 0 RDBNoSQL 0 RDBIO 0 SQL cachehit rate 0 RDB 0 RDB 0 14. NoSQL(6/6)NOSQL 15. What is NoSQLWhy NoSQL MongoDB Introduction MongoDB HA MongoDB C# Driver MongoDB Install & Setup 16. MongoDB(1/3) 0 open source 0 C++ 0 0 Schema 0 Doucument 0 BSONJSON 0 RUBYPYTHONJAVAPHPC++C# 17. MongoDB(2/3) 0 0 0 replicaSharding 0 0 BSON(),16M 0 MongoDBLinuxWindowsOS X 326427017 64MongoDB32 2GB 18. MongoDB(3/3) 0 Memory-mapped file 0 Memory-mapped 19. MongoDB(1/7) 0 MSSQL(database)(table)(rows) MongoDB (database) (collection)(document) MongoDB documentdocument Schema 20. MongoDB(2/7) 21. MongoDB(3/7) 0 MongoDBdocumentBSONBinary JSONBSONJSONJSON 6null BSON32 64 22. MongoDB(4/7) 0 nullnull {one:null} 0 booleantruefalse {one:true} 0 32mongoDBJSJS 6432 0 646432MongoDB 64 23. MongoDB(5/7) 0 64MongoDB {one:2.02} {one:10} 0 UTF-8 {one:Hello World} 24. MongoDB(6/7) 0 ObjectId id12ID 0|1|2|3|4|5|6|7|8|9|10|11 | | PID | ObjectId("4eae239f63520362e051e7fd") 0 new {one:new Date()} 0 JS {one:/ho/i} 25. MongoDB(7/7) 0 codeJS code {one:function(){/*.*/}} 0Array {x:[a,b,[c,d]]} 0 documentdocumentdocument {x:{name:Tom,age:20}} 26. (1/6) > db.users.insert({"_id":1,"name":"mongo"}) > show dbs admin (empty) local (empty) mydb 0.0625GB > show collections system.indexes users > db.users.find() { "_id" : 1, "name" : "mongo" } 27. (2/6) 0 MongoDB document_id MongoDB ObjectId 0 MongoDBGUID ID 28. (3/6) > a={"name":"caida"} { "name" : "caida" } > b={"age":24} { "age" : 24 } > db.users.insert(a); > db.users.save(b); > db.users.find() { "_id" : 1, "name" : "mongo" } { "_id" : ObjectId("4eb2a192bf10550b2177b6f7"), "name" : "caida" } { "_id" : ObjectId("4eb2a199bf10550b2177b6f8"), "age" : 24 } 29. (4/6) > db.users.remove({"name":"caida"}) > db.users.find() { "_id" : 1, "name" : "mongo" } { "_id" : ObjectId("4eb2a199bf10550b2177b6f8"), "age" : 24 }0 db.collname.remove({}) 30. (5/6) > db.users.update({"_id":1},{"name":"nosql"}) > db.users.find() { "_id" : 1, "name" : "nosql" } { "_id" : ObjectId("4eb2a199bf10550b2177b6f8"), "age" : 24 }0 db.collname.update({},{}) 31. (6/6) > db.users.find() { "_id" : 1, "name" : "nosql" } { "_id" : ObjectId("4eb2a199bf10550b2177b6f8"), "age" : 24 } > db.users.find({"name":"nosql"}) { "_id" : 1, "name" : "nosql" }0 db.collname.find({}) 32. GridFS GridFSMongoDBGridFS GridFSreplicasharding GridFS GridFSDisk GridFS (Chunks) 33. What is NoSQLWhy NoSQL MongoDB Introduction MongoDB HA MongoDB C# Driver MongoDB Install & Setup 34. Replica Set(1/2) 35. Replica Set(2/2) 0 Replica Setfailoverloadbalance 0 instanceinstance instanceMongoDB 0 PrimarySecondary PrimarySecondary Primary NodeNode Primary 36. Sharding(1/7) 0 0 0 sharding 0 B 0 Mongosharding 0 replica set 37. Sharding(2/7) 38. Sharding(3/7) 0 Mongos 0 Mongos 0 mongod 0 mongodb 0 0 mongos sharding 0 39. Sharding(4/7) 0 Config 0 config 0 config mongod 0 3 config replica set mongos 0 config config sharding 40. Sharding(5/7) 0 Shard 0 0 shard mongod replica set 0 sharding replica set 0 sharding db shard chunk shard 41. Sharding(6/7) 42. Sharding(7/7) 43. What is NoSQLWhy NoSQL MongoDB Introduction MongoDB HA MongoDB C# Driver MongoDB Install & Setup 44. MongoDB C# / .NET Driver 0 http://docs.mongodb.org/ecosystem/drivers/csharp/ 0 IDE 0 Visual Studio 2010 0 Visual Studio 2012 0 .NET Versions 0 .NET 3.5 0 .NET 4.0 0 .NET 4.5 0 LINQ 45. Get from NuGet 46. C# Driver (1/) 47. C# Driver (1/9) 48. C# Driver (2/9) 49. C# Driver (3/9) 50. C# Driver (4/9) 51. C# Driver (5/9) 52. C# Driver (6/9) 53. C# Driver (7/9) 54. C# Driver (8/9) 55. C# Driver (9/9) 56. What is NoSQLWhy NoSQL MongoDB Introduction MongoDB HA MongoDB C# Driver MongoDB Install & Setup 57. 0 instancereplica set 0 nodeip10.20.4.101, 10.20.4.102, 10.20.4.103 0 Port : 27017 0 port : 28017 0 58. 0 http://www.mongodb.org/downloads 0 64-bit *2008R2+ 0 59. 0 log data logs 0 replica setkey keynode key keykey.txt 60. 0 cd C:mongodb-win32-x86_64-2008plus-2.4.5bin mongod.exe -dbpath "C:mongodb-win32-x86_64-2008plus-2.4.5data" -logpath "C:mongodb-win32-x86_64-2008plus-2.4.5logsmongod.txt" -auth --install --replSet crm2 --keyFile "C:mongodb-win32-x86_642008plus-2.4.5keykey.txt" --rest net start MongoDB0 --dbpathdb 0 --logpathlog 0 --auth 0 --installwindows service 0 -replSet crm2crm2 0 --keyFilekey 0 --restrest api 61. (1/4) 0 nodeport : 27017 0 10.20.4.102Primary 10.20.4.102cmd.exe mongo 62. (2/4) 0 rs.initiate()replica set 0 rs.add(10.20.4.101)101replica set 0 rs.add(10.20.4.103)103replica set 0 rs.conf() 0 rs.status() 63. (3/4) 64. (4/4) 0 replica setSecondary101103 rs.slaveOk() secondary load balance 65. 0 primary 0 use admin 0 db.addUser({user},{pwd}) 0 66. (1/2) 67. (2/2) 68. MongoVUE(1/2) 0 GUI 0 http://www.mongovue.com/downloads/ 69. MongoVUE(2/2)