太多的打开文件,同时确保索引mongo [英] Too many open files while ensure index mongo

查看:109
本文介绍了太多的打开文件,同时确保索引mongo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在mongo集合上创建文本索引。我写

  db.test1.ensureIndex({'text':'text'})

然后我在mongod进程中看到

  Sun Jan 5 10:08:47.289 [conn1] build index library.test1 {_fts:text,_ftsx:1} 
Sun Jan 5 10:09:00.220 [conn1] Index: )外部排序进度:200/980 20%
Sun 1月5日10:09:13.603 [conn1]索引:(1/3)外部排序进度:400/980 40%
Sun 1月5日10: (1/3)外部排序进度:600/980 61%
Sun 1月5日10:09:37.809 [conn1]指数:(1/3)外部排序进度:800 / 980 81%
Sun Jan 5 10:09:49.344 [conn1]使用外部排序:62秒内5547个文件
Sun Jan 5 10:09:49.346 [conn1]断言:16392:FileIterator不能打开文件:data / _tmp / esort.1388912927.0 // file.233errno:24打开文件太多

我使用MaxOSX 10.9.1。
请帮助。

解决方案

我有同样的问题(执行不同的操作,但仍然是太多的打开的文件错误),正如lese所说,它似乎是运行mongod的机器上的'maxfiles'限制。



在Mac上,它更好地检查限制:

  sudo launchctl限制

这给了你:

 < limit name> <软限制> <硬限制> 
cpu无限无限
文件大小无限无限
数据无限无限
堆栈8388608 67104768
核心0无限
rss无限无限
memlock无限无限
maxproc 709 1064
maxfiles 1024 2048

我是如何解决问题的是临时设置更高的限制(我最初是像软:256,硬:1000或类似奇怪的东西):

  sudo launchctl limit maxfiles 1024 2048 

然后重新运行查询/索引操作并查看它是否中断。如果没有,并且保持更高的限制(当你退出你设置的shell会话时它们会重置),用下面的行创建一个'/etc/launchd.conf'文件:

  limit maxfiles 1024 2048 



< (或者将该行添加到现有的launchd.conf文件中,如果已有的话)。



这将在登录时通过每个shell的launchctl设置maxfile。

I would like to create text index on mongo collection. I write

db.test1.ensureIndex({'text':'text'})

and then i saw in mongod process

Sun Jan  5 10:08:47.289 [conn1] build index library.test1 { _fts: "text", _ftsx: 1 }
Sun Jan  5 10:09:00.220 [conn1]         Index: (1/3) External Sort Progress: 200/980    20%
Sun Jan  5 10:09:13.603 [conn1]         Index: (1/3) External Sort Progress: 400/980    40%
Sun Jan  5 10:09:26.745 [conn1]         Index: (1/3) External Sort Progress: 600/980    61%
Sun Jan  5 10:09:37.809 [conn1]         Index: (1/3) External Sort Progress: 800/980    81%
Sun Jan  5 10:09:49.344 [conn1]      external sort used : 5547 files  in 62 secs
Sun Jan  5 10:09:49.346 [conn1] Assertion: 16392:FileIterator can't open file: data/_tmp/esort.1388912927.0//file.233errno:24 Too many open files

I work on MaxOSX 10.9.1. Please help.

解决方案

I've had the same problem (executing a different operation, but still, a "Too many open files" error), and as lese says, it seems to be down to the 'maxfiles' limit on the machine running mongod.

On a mac, it is better to check limits with:

sudo launchctl limit

This gives you:

<limit name> <soft limit> <hard limit>
    cpu         unlimited      unlimited      
    filesize    unlimited      unlimited      
    data        unlimited      unlimited      
    stack       8388608        67104768       
    core        0              unlimited      
    rss         unlimited      unlimited      
    memlock     unlimited      unlimited      
    maxproc     709            1064           
    maxfiles    1024           2048  

What I did to get around the problem was to temporarily set the limit higher (mine was originally something like soft: 256, hard: 1000 or something weird like that):

sudo launchctl limit maxfiles 1024 2048

Then re-run the query/indexing operation and see if it breaks. If not, and to keep the higher limits (they will reset when you log out of the shell session you've set them on), create an '/etc/launchd.conf' file with the following line:

limit maxfiles 1024 2048

(or add that line to your existing launchd.conf file, if you already have one).

This will set the maxfile via launchctl on every shell at login.

这篇关于太多的打开文件,同时确保索引mongo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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