mongodb 3.0 配置

來源:互聯網
上載者:User

標籤:mongdb   3.0   

mongodb 3.0 算是一個革命性的版本,得益於新版的儲存引擎WiredTiger,大幅提升效能的同時,極高的提升了資料壓縮(300%)。


效能對比參見:https://comerford.cc/2015/02/04/mongodb-3-0-testing-compression/


安裝文檔:https://docs.mongodb.org/manual/administration/install-on-linux/


如果你僅僅是安裝了mongodb,然後就啟動它,很抱歉,它依然運行緩慢,預設的儲存引擎依然是老舊的MMAPV1


預設配置etc/mongo.conf ,實在是平淡無奇,它實際上是一個yaml格式的文本,趕快用下面的配置替換它吧,可立馬實現鳥槍換炮。


systemLog:

  destination: file

  path: /var/log/mongodb/mongod.log

  logAppend: true


processManagement:

  fork: true

  pidFilePath: /var/run/mongodb/mongod.pid


net:

  bindIp: 127.0.0.1

  port: 27017


storage:

  journal:

    enabled: true

  dbPath: /var/lib/mongo

  directoryPerDB: true

  syncPeriodSecs: 60

  engine: wiredTiger

  wiredTiger:

      engineConfig:

            cacheSizeGB: 1

            directoryForIndexes: false

            journalCompressor: snappy

      collectionConfig:

            blockCompressor: snappy

      indexConfig:

            prefixCompression: true



特別需要注意的是,yaml格式的檔案不支援tab定位字元,因此特別需要注意段落檔案對齊,否則mongodb會啟動失敗。



本文出自 “專註Linux 營運” 部落格,請務必保留此出處http://purplegrape.blog.51cto.com/1330104/1675434

mongodb 3.0 配置

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.