1. 程式人生 > >Mongo3.4 Storage Engines儲存引擎(將MongoDB例項更改為WiredTiger儲存引擎)

Mongo3.4 Storage Engines儲存引擎(將MongoDB例項更改為WiredTiger儲存引擎)

本教程提供了改變獨立MongoDB例項的儲存引擎為wiredtiger儲存引擎的概述。

注意:

本教程使用mongodump和mongorestore工具匯出和匯入資料,確保MongoDB元件安裝在你的系統之中,另外,確保使用WiredTiger執行的MongoDB例項有足夠的儲存空間供mongodump匯出檔案和資料檔案。

1.啟動將要使用WiredTiger儲存引擎的mongo例項

2.使用mongodump匯出資料

mongodump --out <exportDataDestination>
適當的指定其他的引數選項,如果開啟了authorization認證加上username和password

3.為使用WiredTiger儲存引擎執行的mongod例項建立一個目錄,mongod必須對這個目錄擁有讀和寫的許可權

4.啟動mongod例項並且指定儲存引擎為WiredTiger和資料儲存目錄

mongod --storageEngine wiredTiger --dbpath <newWiredTigerDBPath>
5.使用mongorestore匯入資料檔案
mongorestore <exportDataDestination>