mongodb replicat internal(一)
這幾天在看MONGODB權威指南,第十二章提到了,複製集建立索引的時候,可以把備份節點啟動到standalone方式,然後先在備份節點建立索引,然後再在主節點建立索引,這中間的好處我就不寫了,我在考慮,備份節點以stand alone方式啟動後,建立索引後也會產生oplog,等下一次備份節點正常啟動加入叢集后,根據自己的oplog去檢視主節點或者備份節點的oplog,豈不是會對不上,那麼怎麼這些多餘的OPLOG怎麼處理?
> use local
switched to db local
> db.oplog.rs.find().sort({$natural:-1}).limit(2)
{ "ts" : Timestamp(1390301622, 1000), "h" : NumberLong("793634680372110302"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4f"), "count" : 999 } }
{ "ts" : Timestamp(1390301622, 999), "h" : NumberLong("683697805657698615"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4e"), "count" : 998 } }
> use test
switched to db test
> db.coll.ensureIndex({count:1})
> db.coll.stats()
{
"ns" : "test.coll",
"count" : 3000,
"size" : 120008,
"avgObjSize" : 40.00266666666667,
"storageSize" : 348160,
"numExtents" : 4,
"nindexes" : 2,
"lastExtentSize" : 262144,
"paddingFactor" : 1,
"systemFlags" : 1,
"userFlags" : 0,
"totalIndexSize" : 196224,
"indexSizes" : {
"_id_" : 106288,
"count_1" : 89936
},
"ok" : 1
}
> use local
switched to db local
> db.oplog.rs.find().sort({$natural:-1}).limit(2)
{ "ts" : Timestamp(1390301622, 1000), "h" : NumberLong("793634680372110302"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4f"), "count" : 999 } }
{ "ts" : Timestamp(1390301622, 999), "h" : NumberLong("683697805657698615"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4e"), "count" : 998 } }
咦?發現索引建立的OPLOG根本沒記錄到OPLOG集合裡。
再試試其他操作
> for (i=0; i<1000; i++) {db.coll.insert({count: i}) }
> db.coll.stats()
{
"ns" : "test.coll",
"count" : 4000,
"size" : 160008,
"avgObjSize" : 40.002,
"storageSize" : 348160,
"numExtents" : 4,
"nindexes" : 2,
"lastExtentSize" : 262144,
"paddingFactor" : 1,
"systemFlags" : 1,
"userFlags" : 0,
"totalIndexSize" : 302512,
"indexSizes" : {
"_id_" : 138992,
"count_1" : 163520
},
"ok" : 1
}
> db.oplog.rs.find().sort({$natural:-1}).limit(2)> use local
switched to db local
> db.oplog.rs.find().sort({$natural:-1}).limit(2)
{ "ts" : Timestamp(1390301622, 1000), "h" : NumberLong("793634680372110302"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4f"), "count" : 999 } }
{ "ts" : Timestamp(1390301622, 999), "h" : NumberLong("683697805657698615"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4e"), "count" : 998 } }
>
依然沒有記錄。看來MONGO會識別到你啟動的備份節點是一個RS節點,當以stand alone方式啟動後,不會記錄你在裡面進行的修改操作。
> use local
switched to db local
> db.oplog.rs.find().sort({$natural:-1}).limit(2)
{ "ts" : Timestamp(1390301622, 1000), "h" : NumberLong("793634680372110302"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4f"), "count" : 999 } }
{ "ts" : Timestamp(1390301622, 999), "h" : NumberLong("683697805657698615"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4e"), "count" : 998 } }
> use test
switched to db test
> db.coll.ensureIndex({count:1})
> db.coll.stats()
{
"ns" : "test.coll",
"count" : 3000,
"size" : 120008,
"avgObjSize" : 40.00266666666667,
"storageSize" : 348160,
"numExtents" : 4,
"nindexes" : 2,
"lastExtentSize" : 262144,
"paddingFactor" : 1,
"systemFlags" : 1,
"userFlags" : 0,
"totalIndexSize" : 196224,
"indexSizes" : {
"_id_" : 106288,
"count_1" : 89936
},
"ok" : 1
}
> use local
switched to db local
> db.oplog.rs.find().sort({$natural:-1}).limit(2)
{ "ts" : Timestamp(1390301622, 1000), "h" : NumberLong("793634680372110302"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4f"), "count" : 999 } }
{ "ts" : Timestamp(1390301622, 999), "h" : NumberLong("683697805657698615"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4e"), "count" : 998 } }
咦?發現索引建立的OPLOG根本沒記錄到OPLOG集合裡。
再試試其他操作
> for (i=0; i<1000; i++) {db.coll.insert({count: i}) }
> db.coll.stats()
{
"ns" : "test.coll",
"count" : 4000,
"size" : 160008,
"avgObjSize" : 40.002,
"storageSize" : 348160,
"numExtents" : 4,
"nindexes" : 2,
"lastExtentSize" : 262144,
"paddingFactor" : 1,
"systemFlags" : 1,
"userFlags" : 0,
"totalIndexSize" : 302512,
"indexSizes" : {
"_id_" : 138992,
"count_1" : 163520
},
"ok" : 1
}
> db.oplog.rs.find().sort({$natural:-1}).limit(2)> use local
switched to db local
> db.oplog.rs.find().sort({$natural:-1}).limit(2)
{ "ts" : Timestamp(1390301622, 1000), "h" : NumberLong("793634680372110302"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4f"), "count" : 999 } }
{ "ts" : Timestamp(1390301622, 999), "h" : NumberLong("683697805657698615"), "v" : 2, "op" : "i", "ns" : "test.coll", "o" : { "_id" : ObjectId("52de51b6a69b146212ea6d4e"), "count" : 998 } }
>
依然沒有記錄。看來MONGO會識別到你啟動的備份節點是一個RS節點,當以stand alone方式啟動後,不會記錄你在裡面進行的修改操作。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22034023/viewspace-1073616/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- replicat的handcollisions和reperrorError
- ERROR: Could not delete DB checkpoint for REPLICATErrordelete
- HANDLECOLLISIONS :GoldenGate Replicat的引數Go
- ogg replicat 程式 abend 處理
- Index internal 結構 試驗一Index
- 強制關閉extract和replicat程式
- 【Mongodb】Mongodb sharding 管理之一MongoDB
- oracle internalOracle
- VulNyx - Internal
- 瞭解GoldenGate Replicat的HANDLECOLLISIONS引數Go
- OGG 中replicat 和extract 關係圖
- 搭建高可用MongoDB叢集(一):配置MongoDBMongoDB
- 使用OGG"Loading data from file to Replicat"的方法應該注意的問題:replicat程式是前臺程式...
- Extract or Replicat Fail to Start (Don't Start) With No Error MessagesAIError
- Oracle-InternalOracle
- MongoDB系列一(索引及C#如何操作MongoDB)MongoDB索引C#
- C#中public、private、protected、internal、protected internal (轉載)C#
- OGG Replicat Failed Due To Check_point Table beingTruncatedAI
- OGG EXTRACT / REPLICAT CHECKPOINT RBA IS LARGER THAN LOCAL TRAIL SIZEAI
- Mongodb的安裝(一)MongoDB
- 學習MongoDB 一:MongoDB 入門(安裝與配置)MongoDB
- oracle INTERNAL_FUNCTIONOracleFunction
- Btree Index storage internalIndex
- Internal Server Error..ServerError
- OGG的replicat程式的Time Since Chkpt一直增加,程式處於假死狀態
- 快速掌握mongoDB(一)——mongoDB安裝部署和常用shell命令MongoDB
- MongoDB之索引(唯一索引)MongoDB索引
- MongoDB 3.0新增特性一覽MongoDB
- mongodb學習筆記一MongoDB筆記
- 深入理解MongoDB(一)Linux下配置MongoDB全攻略MongoDBLinux
- git internal for computer scientistsGit
- GoldenGate12.3中新增的Parallel Replicat (PR)介紹GoParallel
- 配置GoldenGate捕獲Replicat端資料應用異常Go
- goldengate 目的端replicat程式 執行緩慢的問題Go
- ORA-00600: internal error code, arguments: [ktecgeb-2], (一)Error
- 天生一對,當遊戲遇上MongoDB遊戲MongoDB
- mongoDB初探第一篇MongoDB
- mongodb 的一些日常操作MongoDB