Your SlideShare is downloading. ×
MongoDB Oplog入門
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

MongoDB Oplog入門

7,762

Published on

Published in: Technology, Business
0 Comments
14 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
7,762
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
56
Comments
0
Likes
14
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. http://www.mongodb.org/display/DOCS/Replica+Sets+-+Oplog
  • 2. myset:PRIMARY> db.mycoll.insert({x:1})myset:PRIMARY> db.mycoll.update({x:1}, {$set : {y:1}})myset:PRIMARY> db.mycoll.update({x:2}, {$set : {y:1}}, true)myset:PRIMARY> db.mycoll.remove({x:1})myset:PRIMARY> db.mycoll.find(){ "_id" : ObjectId("4def8e5fb07da951204c60e0"), "x" : 1, "y" : 1 }{ "_id" : ObjectId("4def8e5fd60f868d9ea77776"), "x" : 2, "y" : 1 }
  • 3. myset:PRIMARY> use localmyset:PRIMARY> db.oplog.rs.find().sort({$natural:-1}){ "ts" : { "t" : 1307545183000, "i" : 4 }, "h" : NumberLong("-1214445074120755058"), "op" : "d","ns" : "test.mycoll", "b" : true, "o" : { "_id" : ObjectId("4def8e5fb07da951204c60e0") } }{ "ts" : { "t" : 1307545183000, "i" : 3 }, "h" : NumberLong("296197708926251535"), "op" : "i","ns" : "test.mycoll", "o" : { "_id" : ObjectId("4def8e5fd60f868d9ea77776"), "x" : 2, "y" : 1 } }{ "ts" : { "t" : 1307545183000, "i" : 2 }, "h" : NumberLong("6923456793495821492"), "op" : "u","ns" : "test.mycoll", "o2" : { "_id" : ObjectId("4def8e5fb07da951204c60e0") }, "o" : { "$set" :{ "y" : 1 } } }{ "ts" : { "t" : 1307545183000, "i" : 1 }, "h" : NumberLong("-4148240362977057242"), "op" : "i","ns" : "test.mycoll", "o" : { "_id" : ObjectId("4def8e5fb07da951204c60e0"), "x" : 1 } }...
  • 4. Wed Jun 8 23:53:38 [conn6] getmore local.oplog.rs cid:3687673685314762755 getMore:{ ts: { $gte: new Date(5615858237044687812) } } bytes:20 nreturned:0 3022msWed Jun 8 23:53:38 [conn8] getmore local.oplog.rs cid:9178181051262829411 getMore:{ ts: { $gte: new Date(5615858237044687812) } } bytes:20 nreturned:0 3046msWed Jun 8 23:53:41 [conn8] getmore local.oplog.rs cid:9178181051262829411 getMore:{ ts: { $gte: new Date(5615858237044687812) } } bytes:20 nreturned:0 3041msWed Jun 8 23:53:41 [conn6] getmore local.oplog.rs cid:3687673685314762755 getMore:{ ts: { $gte: new Date(5615858237044687812) } } bytes:20 nreturned:0 3043ms...
  • 5. myset:SECONDARY> db.oplog.rs.find().sort({$natural:-1}){ "ts" : { "t" : 1307545183000, "i" : 4 }, "h" : NumberLong("-1214445074120755058"), "op" : "d","ns" : "test.mycoll", "b" : true, "o" : { "_id" : ObjectId("4def8e5fb07da951204c60e0") } }{ "ts" : { "t" : 1307545183000, "i" : 3 }, "h" : NumberLong("296197708926251535"), "op" : "i","ns" : "test.mycoll", "o" : { "_id" : ObjectId("4def8e5fd60f868d9ea77776"), "x" : 2, "y" : 1 } }{ "ts" : { "t" : 1307545183000, "i" : 2 }, "h" : NumberLong("6923456793495821492"), "op" : "u","ns" : "test.mycoll", "o2" : { "_id" : ObjectId("4def8e5fb07da951204c60e0") }, "o" : { "$set" :{ "y" : 1 } } }{ "ts" : { "t" : 1307545183000, "i" : 1 }, "h" : NumberLong("-4148240362977057242"), "op" : "i","ns" : "test.mycoll", "o" : { "_id" : ObjectId("4def8e5fb07da951204c60e0"), "x" : 1 } }...

×