mongoDB3.2.8 升级遇到的问题
生活随笔
收集整理的這篇文章主要介紹了
mongoDB3.2.8 升级遇到的问题
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
環境:
4個分片,各個分片3個節點。6臺服務器,每臺服務器都有2-3個 MONGOD (或 mongos) 進程計劃把硬盤,內存及MongoDB 從3.0.3 升級到 3.2.8
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
方法:
新添加了一臺服務器,逐步把每臺機子進行硬盤,內存添加,再安裝系統,再從要升級的服務器中,拷貝數據文件過來。這一切都還算勝利。問題1:
每個節點300G,共600G 的數據,要拷貝3小時左右。也只有等了。 后來為了加快步驟,一臺機子使用集群節點間數據自行同步的辦法,災難就來了,速度奇慢,10多個小時,才同步完成一個節點的數據(300G左右),建立索引這步就慢得不要不要的。。。。??磥砩壍?.4是多么的重要。問題2:
最后一臺服務器中有個節點為主節點,還沒升級完成時,通過mongos想連接,出現以下錯誤:<span style="font-size:18px;">mongos> use dmp switched to db dmp mongos> show tables; 2016-08-14T10:02:20.386+0800 E QUERY [thread1] Error: listCollections failed: {"code" : 133,"ok" : 0,"errmsg" : "could not find host matching read preference { mode: \"primary\", tags: [ {} ] } for set shard3" } : _getErrorWithCode@src/mongo/shell/utils.js:25:13 DB.prototype._getCollectionInfosCommand@src/mongo/shell/db.js:773:1 DB.prototype.getCollectionInfos@src/mongo/shell/db.js:785:19 DB.prototype.getCollectionNames@src/mongo/shell/db.js:796:16 shellHelper.show@src/mongo/shell/utils.js:754:9 shellHelper@src/mongo/shell/utils.js:651:15 @(shellhelp2):1:1mongos> exit</span>
開始還一直往其它問題中去想,弄了半天也沒想到什么好的辦法。 后來同事問,是否有版本問題。我想也不可能啊。都是3.0 以上的版本。 后來想想,反正試試。 把主節點切到新版本(3.2.8)的一個節點上,再測試連接到router的接口上進行訪問MONGODB,問題解決。
問題3:
</pre><blockquote><blockquote><pre name="code" class="javascript"><span style="font-size:18px;">[mongo@mds4 bin]$ ./mongo --port 28011 MongoDB shell version: 3.2.8 connecting to: 127.0.0.1:28011/test Server has startup warnings: 2016-08-13T06:33:25.817+0800 I CONTROL [initandlisten] 2016-08-13T06:33:25.817+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. 2016-08-13T06:33:25.817+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never' 2016-08-13T06:33:25.817+0800 I CONTROL [initandlisten] 2016-08-13T06:33:25.817+0800 I CONTROL [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'. 2016-08-13T06:33:25.817+0800 I CONTROL [initandlisten] ** We suggest setting it to 'never'</span>處理方法
<span style="font-size:18px;"> [root@md5 ~]# cat /sys/kernel/mm/transparent_hugepage/defrag[always] madvise never[root@md5 ~]# echo never > /sys/kernel/mm/transparent_hugepage/enabled[root@md5 ~]# echo never > /sys/kernel/mm/transparent_hugepage/defrag[root@md5 ~]# cat /sys/kernel/mm/transparent_hugepage/defragalways madvise [never][root@md5 ~]# cat /sys/kernel/mm/transparent_hugepage/enabledalways madvise [never][root@md5 ~]# </span>
問題4:
開始設置了oplogszie 為5G,同步完成后,例如出現如下錯誤:2016-08-13T06:57:37.810+0800 I STORAGE [initandlisten] WARNING: the collection 'dp.aedm_advertis' lacks a unique index on _id. This index is needed for replication to function properly 2016-08-13T06:57:37.810+0800 I STORAGE [initandlisten] To fix this, you need to create a unique index on _id. See http://dochub.mongodb.org/core/build-replica-set-indexes 2016-08-13T06:57:37.810+0800 I STORAGE [initandlisten] WARNING: the collection 'dp.aedm_campaign' lacks a unique index on _id. This index is needed for replication to function properly 2016-08-13T06:57:37.810+0800 I STORAGE [initandlisten] To fix this, you need to create a unique index on _id. See http://dochub.mongodb.org/core/build-replica-set-indexes
開始以為在同步時,因為oplogSize不夠,沒有同步索引過來,但查詢索引是有的。
后準備再修改oplogSize?? 后再同步一次呢。但取消 oplogSize? 大小后,再重啟 mongod ,再登錄 后發現問題好了。具體原因還有待再分析 了。
結論:
? ? ? 看來在做數據庫升級時,還是要多準備一些,確認是否有版本兼容問題。前面在做各臺服務器升級時,也沒具體去測試那時是否有連接問題,同事已把WEB 服務關閉了。有可能那時都有這個問題。 如果真是上面所說??赡芴砑右粋€新版本的節點時,就要把primary 切換到新版本的節點來了。 并且先要把config server,router server 做升級。就象是從2.x 版本升級到 3.x 時一樣。總結
以上是生活随笔為你收集整理的mongoDB3.2.8 升级遇到的问题的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 集群节点间的延迟问题
- 下一篇: 三种基本的存储引擎比较