2017-07-07 113 views
-1

我們正試圖從mongo 2.4.9遷移到3.4,我們有很多數據,所以我們試圖設置複製並等待數據同步,然後交換主數據。 配置完成,但何時啓動複製新的服務器不能穩定複製:Mongodb複製沒有啓動

017-07-07T12:07:22.492+0000 I REPL  [replication-1] Starting initial sync (attempt 10 of 10) 
2017-07-07T12:07:22.501+0000 I REPL  [replication-1] sync source candidate: mongo-2.blabla.com:27017 
2017-07-07T12:07:22.501+0000 I STORAGE [replication-1] dropAllDatabasesExceptLocal 1 
2017-07-07T12:07:22.501+0000 I REPL  [replication-1] ****** 
2017-07-07T12:07:22.501+0000 I REPL  [replication-1] creating replication oplog of size: 6548MB... 
2017-07-07T12:07:22.504+0000 I STORAGE [replication-1] WiredTigerRecordStoreThread local.oplog.rs already started 
2017-07-07T12:07:22.505+0000 I STORAGE [replication-1] The size storer reports that the oplog contains 0 records totaling to 0 bytes 
2017-07-07T12:07:22.505+0000 I STORAGE [replication-1] Scanning the oplog to determine where to place markers for truncation 
2017-07-07T12:07:22.519+0000 I REPL  [replication-1] ****** 
2017-07-07T12:07:22.521+0000 I REPL  [replication-1] Initial sync attempt finishing up. 
2017-07-07T12:07:22.521+0000 I REPL  [replication-1] Initial Sync Attempt Statistics: { failedInitialSyncAttempts: 9, maxFailedInitialSyncAttempts: 10, initialSyncStart: new Date(1499429233163), initialSyncAttempts: [ { durationMillis: 0, status: "CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find", syncSource: "mongo-2.blabla.com:27017" }, { durationMillis: 0, status: "CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find", syncSource: "mongo-2.blabla.com:27017" }, { durationMillis: 0, status: "CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find", syncSource: "mongo-2.blabla.com:27017" }, { durationMillis: 0, status: "CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find", syncSource: "mongo-2.blabla.com:27017" }, { durationMillis: 0, status: "CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find", syncSource: "mongo-2.blabla.com:27017" }, { durationMillis: 0, status: "CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find", syncSource: "mongo-2.blabla.com:27017" }, { durationMillis: 0, status: "CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find", syncSource: "mongo-2.blabla.com:27017" }, { durationMillis: 0, status: "CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find", syncSource: "mongo-2.blabla.com:27017" }, { durationMillis: 0, status: "CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find", syncSource: "mongo-2.blabla.com:27017" } ] } 
2017-07-07T12:07:22.521+0000 E REPL  [replication-1] Initial sync attempt 
failed -- attempts left: 0 cause: CommandNotFound: error while getting last 
oplog entry for begin timestamp: no such cmd: find 
2017-07-07T12:07:22.521+0000 F REPL  [replication-1] The maximum number 
of retries have been exhausted for initial sync. 
2017-07-07T12:07:22.522+0000 E REPL  [replication-0] Initial sync failed, 

shutting down now. Restart the server to attempt a new initial sync. 
2017-07-07T12:07:22.522+0000 I -  [replication-0] Fatal assertion 40088 CommandNotFound: error while getting last oplog entry for begin timestamp: no such cmd: find at src/mongo/db/repl/replication_coordinator_impl.cpp 632 

請assits傢伙,因爲我們有超過100G的數據,所以轉儲和恢復將需要大量的停機時間

配置: 3.4.5新機:

storage: 
    dbPath: /mnt/dbpath 
    journal: 
    enabled: true 
    engine: wiredTiger 
    systemLog: 
    destination: file 
    logAppend: true 
    path: /var/log/mongodb/mongod.log 
    net: 
    port: 27017 
    replication: 
    replSetName: prodTest 

2.4.9舊機器數據:

dbpath=/var/lib/mongodb 
logpath=/var/log/mongodb/mongodb.log 
logappend=true port = 27017 
+0

發表您的MongoDB配置選項 –

+0

** 3.4.5新機:** 存儲: DBPATH:到/ mnt/DBPATH 雜誌: 啓用:真 引擎:wiredTiger systemLog: 目的地:文件 logAppend:真 路徑:/var/log/mongodb/mongod.log 淨: 端口:27017 複製: replSetName:prodTest ** 2.4.9舊機數據:** DBPATH =的/ var/lib中/ mongodb的 logpath =/var/log/mongodb/mongodb.log logappend = true port = 27017 –

+0

看起來你正在嘗試使用MongoDB 2.4.x和3.4.x來設置混合副本集以升級。這是行不通的:只有在相鄰的主要版本(2.4 => 2.6,2.6 => 3.0)之間支持用於升級目的的混合複製。有關支持的成功升級方法,請查看[MongoDB發行說明](https://docs.mongodb.com/manual/release-notes/)。有關[DBA StackExchange](https://dba.stackexchange.com/tags/mongodb)的升級或管理問題也更多。 – Stennie

回答

0

任務已經解決了這樣的方式:

  1. - 創建副本主V2.4,3個奴隸-V2.6
  2. -stop應用,下臺主
  3. -stop新主人和蒙戈版本升級到3.0版,
  4. 啓動主機和sequentually升級奴隸3.2(從數據庫文件刪除 新版本開始wiredTiger引擎)
  5. - 工序下來高手,升級所有的奴隸3.4

這個過程變得非常快,因爲40G db的副本從恢復大約需要30米。