我正在OSX Mavericks上使用Elasticsearch-Exporter执行转储到elasticsearch:node /usr/bin/node_modules/elasticsearch-exporter/exporter.js -j ${esIndexName} -f esbackup
我有一个运行两个节点的应用程序,该应用程序节点与应用程序节点加起来总共有三个节点。 elasticsearch
命令创建的节点是主节点。当我对索引运行export命令时,在成功加载几秒钟后会得到以下信息:
2014-05-07T14:31:38.325-0700 [elasticsearch[Rancor][[es][1]: Lucene Merge Thread #0]] [WARN] merge.scheduler [][] - [Rancor] [es][1] failed to merge
815 java.io.FileNotFoundException: /private/var/data/core/elasticsearch_me/nodes/0/indices/es/1/index/_f_es090_0.tip (Too many open files)
我尝试了以下方法:
launchctl limit 10000
sudo launchctl limit 40000 65000
elasticsearch soft nofile 32000
elasticsearch hard nofile 32000
将
-XX:-MaxFDLimit
添加到我的应用程序的jvm参数中没有一个能解决我的问题。有时候,加载会完成而不会出错,但是大多数时候我都会遇到该错误。有人对我的问题有任何想法/提示吗?
编辑:
$ launchctl 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 10000 10240
$ sudo launchctl limitPassword: 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 40000 65000
最佳答案
好的-如果您在一台Mac上运行多个Elasticsearch节点以及node.js应用程序,我绝对可以确定您打开的文件数已达到ES建议的限制:
file descriptor
Make sure to increase the number of open files descriptors on the machine (or for the user running elasticsearch). Setting it to 32k or even 64k is recommended.
In order to test how many open files the process can open, start it with -Des.max-open-files set to true. This will print the number of open files the process can open on startup.
Alternatively, you can retrieve the max_file_descriptors for each node using the Nodes Info API, with:
curl localhost:9200/_nodes/process?pretty
您需要确定这是针对运行ES的用户完成的,而不仅仅是root用户(除非您以root用户身份运行)。
为此,我将遵循以下指示:(http://elasticsearch-users.115913.n3.nabble.com/quot-Too-many-open-files-quot-error-on-Mac-OSX-td4034733.html)。假设您希望使用32k和64k作为限制:
In /etc/launchd.conf put:
limit maxfiles 32000 64000
Make sure in your ~/.bashrc file you are not setting the ulimit with something like "ulimit -n 1024".
Open a new terminal, and run:
launchctl limit maxfiles
ulimit -a
进行这些更改后,请不要忘记重新启动。然后,当您启动elasticsearch时,请在此命令行参数中传递:
elasticsearch -XX:-MaxFDLimit
在Mac上执行上述步骤后,我从Elasticsearch得到以下响应:
curl http://localhost:9200/_nodes/process?pretty
{
"cluster_name" : "elasticsearch",
"nodes" : {
"XXXXXXXXXXXXXXXXXXXXXXX" : {
"name" : "Marrina Smallwood",
"transport_address" : "inet[XX.XX.XX.XX:9300]",
"host" : "MacBook-Pro-Retina.local",
"ip" : "XX.XX.XX.XX",
"version" : "1.1.1",
"build" : "f1585f0",
"http_address" : "inet[/XX.XX.XX.XX:9200]",
"process" : {
"refresh_interval" : 1000,
"id" : 538,
"max_file_descriptors" : 32768,
"mlockall" : false
}
}
}
}