블로그 이미지
BJcomm
bjcomm

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

글 보관함

calendar

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
12-19 09:35

# mongo
MongoDB shell version: 3.0.2
connecting to: test
Server has startup warnings: 
2015-05-09T12:34:19.688-0700 I CONTROL  [initandlisten] 
2015-05-09T12:34:19.688-0700 I CONTROL  [initandlisten] ** WARNING: soft rlimits too low. rlimits set to 1024 processes, 64000 files. Number of processes should be at least 32000 : 0.5 times number of files.
>  


mongodb当前限制:1024 processes, 64000 files

mongodb建议要求:processes = 0.5*files=32000(至少)


所以需要将 processes  从1024 改为 32000 或更大.



查看当前mongodb进程信息:


[root@localhost ~]# ps -ef | grep mongod

  1. mongod   24283     1  0 12:35 ?        00:00:04 /usr/bin/mongod -f /etc/mongod.conf  
  2. root     24240 22049  0 12:45 pts/2    00:00:00 grep mongod  


[root@localhost ~]# cat /proc/24283/limits

#可以看到限制:Max processes,Max open files 

  1. Limit                     Soft Limit           Hard Limit           Units       
  2. Max cpu time              unlimited            unlimited            seconds     
  3. Max file size             unlimited            unlimited            bytes       
  4. Max data size             unlimited            unlimited            bytes       
  5. Max stack size            10485760             unlimited            bytes       
  6. Max core file size        0                    unlimited            bytes       
  7. Max resident set          unlimited            unlimited            bytes       
  8. Max processes             1024                 32000                processes   
  9. Max open files            64000                64000                files       
  10. Max locked memory         65536                65536                bytes       
  11. Max address space         unlimited            unlimited            bytes       
  12. Max file locks            unlimited            unlimited            locks       
  13. Max pending signals       14833                14833                signals     
  14. Max msgqueue size         819200               819200               bytes       
  15. Max nice priority         0                    0                      
  16. Max realtime priority     0                    0                      
  17. Max realtime timeout      unlimited            unlimited            us      





修改 Max processes 或者 files ,有几种方法:


方法一:


修改配置文件 /etc/security/limits.d/90-nproc.conf  

[root@localhost ~]# vi /etc/security/limits.d/90-nproc.conf 

  1. *          soft    nproc     1024  
  2. 改为:  
  3. *          soft    nproc     32000  

重启 mongod 服务:

[root@localhost ~]# service mongod restart