Apsaradb for mongodb Oplog

Source: Internet
Author: User
Mongodb Replication stores write operations through a log, which is called Oplog. By default, for 64-bit mongodb, oplogs is quite large-it may be 5% of disk space. Generally, this is a reasonable setting. You can use mongod -- oplogSize to change the Log Size of the Oplog.

Mongodb RepliCatIon stores write operations through a log, which is called Oplog.

By default, for 64-bit mongodb, oplogs is quite large-it may be 5% of disk space. Generally, this is a reasonable setting. You can use mongod -- oplogSize to change the Log Size of the Oplog.

 

OplogColLectio:

Local. oplog. $ main for master/slave replication;

Local. oplog. rs for replicaSetS

For example, master/slave replication:

> Use local
SwitchEdTo db local
> Db. oplog. $ main. help ()
DBCollection help
Db. oplog. $ main.Find(). Help ()-show DBCursor help
Db. oplog. $ main. count ()
Db. oplog. $ main. dataSize ()
Db. oplog. $ main. distiNcT (key)-eg. db. oplog. $ main. distinct ('x ')
Db. oplog. $ main. drop () drop the collection
Db. oplog. $ main. dropIndEx(Name)
Db. oplog. $ main. dropIndexes ()
Db. oplog. $ main. enSuReIndex (keypattern, options)-options shocould be an object with these possible fields: name,UniqUe, dropDups
Db. oplog. $ main. reIndex ()
Db. oplog. $ main. find ([query], [fields])-first parameter is an optional query filter. second parameter is optional set of fields to return.
E.g. db. oplog. $ main. find ({x: 77}, {name: 1, x: 1 })
Db. oplog. $ main. find (...). count ()
Db. oplog. $ main. find (...). limit (n)
Db. oplog. $ main. find (...). skip (n)
Db. oplog. $ main. find (...).Sort(...)
Db. oplog. $ main. findOne ([query])
Db. oplog. $ main. findAndModify ({upDate:..., Remove: bool [, query :{}, sort :{}, 'new': faLsE]})
Db. oplog. $ main. getDB () get DB object associated with collection
Db. oplog. $ main. getIndexes ()
Db. oplog. $ main. group ({key:..., initial:..., reDuCe:... [, cond:...]})
Db. oplog. $ main. mapReduce (mapFunction, cecefunction, )
Db. oplog. $ main. remove (query)
Db. oplog. $ main. renameCollection (newName, ) Renames the collection.
Db. oplog. $ main. runCommand (name, ) Runs a db command with the given name where the first param is the collection name
Db. oplog. $ main. save (obj)
Db. oplog. $ main. StatS ()
Db. oplog. $ main. storageSize ()-Primary des FreeSpace al LocateD to this collection
Db. oplog. $ main. totalIndexSize ()-size in bytes of all the indexes
Db. oplog. $ main. totalSize ()-storage allocated for all data and indexes
Db. oplog. $ main. update (query, object [, upsert_bool, multi_bool])
Db. oplog. $ main. val IdAte ()-SLOW
Db. oplog. $ main. getShardVersion ()-only for use with sharding
> Db. oplog. $ main. find ()
{"Ts": {"t": 1294582140000, "I": 14}, "op": "d", "ns": "mixi_top_city.building_90", "B ": TrUe, "o": {"_ id": "6380690_441_30_29 "}}
{"Ts": {"t": 1294582140000, "I": 15}, "op": "I", "ns": "mixi_top_city.building_90", "o ": {"_ id": "6380690_441_24_24", "uid": "6380690", "x": 24, "y": 24, "pos": 1, "B Time": 1294154452," ntime ": 1294154452," bid ": 71," extprop ": 0," status ": 0," ucid ": 441 }}
{"Ts": {"t": 1294582140000, "I": 16}, "op": "u", "ns": "mixi_top_city.building_64", "o2 ": {"_ id": "16702364_459_14_14"}, "o": {"$ set": {"status": 1 }}}
{"Ts": {"t": 1294582140000, "I": 17}, "op": "u", "ns": "mixi_top_city.building_08", "o2 ": {"_ id": "6223408_391_30_28"}, "o": {"$ set": {"ntime": 1294582321 }}}
{"Ts": {"t": 1294582140000, "I": 18}, "op": "u", "ns": "mixi_top_city.building_03", "o2 ": {"_ id": "9882403_1__28_20"}, "o": {"$ set": {"ntime": 1294600141 }}}
{"Ts": {"t": 1294582140000, "I": 19}, "op": "u", "ns": "mixi_top_city.building_24", "o2 ": {"_ id": "4162924_365_32_28"}, "o": {"$ set": {"ntime": 1294582321 }}}
{"Ts": {"t": 1294582141000, "I": 1}, "op": "u", "ns": "mixi_top_city.building_49", "o2 ": {"_ id": "32797749_285_28_30"}, "o": {"$ set": {"ntime": 1294583341 }}}
{"Ts": {"t": 1294582141000, "I": 2}, "op": "u", "ns": "mixi_top_city.building_50", "o2 ": {"_ id": "33768850_1__28_32"}, "o": {"$ set": {"ntime": 1294582561 }}}
{"Ts": {"t": 1294582141000, "I": 3}, "op": "u", "ns": "mixi_top_city.building_35", "o2 ": {"_ id": "28235635_333_28_36"}, "o": {"$ set": {"ntime": 1294582741 }}}
{"Ts": {"t": 1294582141000, "I": 4}, "op": "u", "ns": "mixi_top_city.building_04", "o2 ": {"_ id": "25178304_3_32_28"}, "o": {"$ set": {"ntime": 1294594141 }}}
{"Ts": {"t": 1294582141000, "I": 5}, "op": "u", "ns": "mixi_top_city.building_18", "o2 ": {"_ id": "7301__445_32_26"}, "o": {"$ set": {"ntime": 1294582321 }}}
{"Ts": {"t": 1294582141000, "I": 6}, "op": "u", "ns": "mixi_top_city.building_93", "o2 ": {"_ id": "5003293_0000_20_24"}, "o": {"$ set": {"status": 1 }}}
{"Ts": {"t": 1294582141000, "I": 7}, "op": "u", "ns": "mixi_top_city.building_59", "o2 ": {"_ id": "19601459_485_28_30"}, "o": {"$ set": {"ntime": 1294582741 }}}
{"Ts": {"t": 1294582141000, "I": 8}, "op": "u", "ns": "mixi_top_city.building_47", "o2 ": {"_ id": "23744647_273_22_46"}, "o": {"$ set": {"ntime": 1294582741 }}}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.