MongoDB Finishing Note のreplica Oplog

Source: Internet
Author: User

Master-Slave operation Log Oplog

MongoDB's replica set schema is a log to store writes, and this log is called "Oplog". Oplog.rs is a fixed-length capped collection that exists in the "local" database for recording replica sets operations logs. By default, the 64-bit mongodb,oplog is relatively large and can reach 5% of the disk space. The size of the Oplog can be set by the Mongod parameter "--oplogsize".

rs1:primary> use localswitched to db localrs1:primary> show collectionsoplog.rssystem.replsetrs1: PRIMARY>"ts": {"T": 1338457763000, "I": 1}, "H": Numberlong (0), "OP": "N", "ns": "", "O": {"msg " :" initiating set "" ts ": {" T ": 1338459114000," I ": 1}," H ": Numberlong (" 5493127699725549585 ")," Op ":" I "," ns ":" Test.c1 "," O ": {" _id ": ObjectId (" 4fc743e9aea289af709ac6b5 ")," Age ":" Name ":" Ton Y " }}rs1:primary>
View Code

Field description

TS: Timestamp for an operation
OP: Operation type, as follows:
I:insert
D:delete
U:update
NS: The namespace, which is the collection name of the operation
O:document's Content

To view the Oplog metadata information for master:

Rs1:primary>. 6837158203125MBlog length start to End:1351secs (017:49:23 gmt+ 080018:11:54 gmt+080018:21:58 gmt+0800 (CST) rs1:primary>
View Code

Configured Oplog Size: configured oplog file size
Log length start to End:oplog time period of the log
Oplog first Event Time: The generation of a transaction log
Oplog Last Event time: The final transaction log is generated

Now: the time

To view the synchronization status of a Slave

Rs1:primary> db.printslavereplicationinfo () source:localhost:2801118:11:54 gmt+0800 (CST)= 884secs ago (0. 25hrs) Source:localhost:2801218:11:54 gmt+0800 (CST) = 884secs ago (0. 25hrs) rs1:primary>
View Code

Field description

Source: IP and port from the library
Syncedto: Current synchronization situation, how long delays and other information

Master-Slave configuration information

In the local library, there is not only a collection of master-slave log oplog, but also a collection for recording master-slave configuration information, namely: System.replset

rs1:primary> use localswitched to db localrs1:primary> show collectionsoplog.rssystem.replsetrs1: PRIMARY>"_id": "Rs1", "Version": 1, "members" : [{"_id": 0,"host": "localhost:28010 "},{" _id ": 1," host ":" localhost:28011 "},{" _id ": 2," host ":" localhost:28012 " }]}rs1:primary>
View Code

As you can see from this collection, the configuration information for Replica sets can also be performed on any of the member instances rs.conf () to view the configuration information.

MongoDB Finishing Note のreplica Oplog

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.