是否有任何限制mongodb内存使用的选项? [英] Is there any option to limit mongodb memory usage?

查看:101
本文介绍了是否有任何限制mongodb内存使用的选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Mongo-DBv1.8.1.我的服务器内存为4GB,但是Mongo-DB占用的内存超过3GB. Mongo-DB中有内存限制选项吗?.

I am using Mongo-DBv1.8.1. My server memory is 4GB but Mongo-DB is utilizing more than 3GB. Is there memory limitation option in Mongo-DB?.

推荐答案

如果运行的是 MongoDB 3.2 或更高版本,则可以将wiredTiger 缓存限制为上面提到过.

If you are running MongoDB 3.2 or later version, you can limit the wiredTiger cache as mentioned above.

/etc/mongod.conf中添加wiredTiger部分

...
# Where and how to store data.
storage:
  dbPath: /var/lib/mongodb
  journal:
    enabled: true
  wiredTiger:
    engineConfig:
        cacheSizeGB: 1
...

这会将缓存大小限制为 1GB ,有关更多信息,请参见

This will limit the cache size to 1GB, more info in Doc

这为我解决了问题,运行ubuntu 16.04mongoDB 3.2

This solved the issue for me, running ubuntu 16.04 and mongoDB 3.2

PS:更改配置后,重新启动mongo守护程序.

PS: After changing the config, restart the mongo daemon.

$ sudo service mongod restart

# check the status
$ sudo service mongod status

这篇关于是否有任何限制mongodb内存使用的选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆