简体   繁体   English

增加 MongoDB 内存限制(或它使用的任何资源)

[英]Increase MongoDB memory limit(or any resources it uses)

I will rent a cloud server(12gb ram, 240gb nvme sdd).我会租一个云服务器(12gb ram,240gb nvme sdd)。 I read mongodb wiredtiger uses limited amount of system memory,我读过 mongodb Wiredtiger 使用有限的系统内存,

Since MongoDB 3.2, MongoDB has used WiredTiger as its default Storage Engine.从 MongoDB 3.2 开始,MongoDB 一直使用 WiredTiger 作为其默认存储引擎。 And by default, MongoDB will reserve 50% of the available memory – 1 GB for the WiredTiger cache or 256 MB whichever is greater.默认情况下,MongoDB 将保留 50% 的可用内存 – 1 GB 用于 WiredTiger 缓存或 256 MB,以较大者为准。

Since i will rent this server just for mongodb(i will have high throughput), i want wiredtiger to use all available system resources, how can i achieve this?.由于我将仅为 mongodb 租用此服务器(我将具有高吞吐量),我希望wiredtiger 使用所有可用的系统资源,我该如何实现呢? Thank you谢谢

Edit your mongo.conf .编辑你的mongo.conf This file is usually located at /etc/mongo.conf该文件通常位于/etc/mongo.conf

change this section:更改此部分:

storage:
  dbPath: /var/lib/mongodb #(example) - don't change this
  journal:
    enabled: true
  wiredTiger:
    engineConfig:
      cacheSizeGB: 12

You may want to experiment with the size to test the stability of your server (may want to make it 1 GB less).您可能希望尝试使用大小来测试服务器的稳定性(可能希望减少 1 GB)。 Remember to restart the mongod service.记得重启mongod服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM