【问题标题】:"Too many open files" on ElasticsearchElasticsearch 上的“打开的文件太多”
【发布时间】:2016-03-14 22:38:16
【问题描述】:

我有一个集群 ES,从 2 天前开始出现这个错误:

[2016-03-14 15:08:48,342][WARN ][cluster.action.shard] [node-01] [logstash-2016.03.14][2] received shard failed for [logstash-2016.03.14][2], node[72oHnFiXTVqgXaUYKTAu2Q], [P], s[INITIALIZING], indexUUID [AKybrAEZRXebyRxcmzTqJQ], reason [Failed to start shard, message [IndexShardGatewayRecoveryException[[logstash-2016.03.14][2] failed recovery]; nested: EngineCreationFailureException[[logstash-2016.03.14][2] failed to open reader on writer]; nested: FileSystemException[/var/lib/elasticsearch/elasticsearch/nodes/0/indices/logstash-2016.03.14/2/index/_lg_Lucene410_0.dvm: Too many open files]; ]]

如果我运行 curl -XGET 'http://localhost:9200/_nodes?os=true&process=true&pretty=true' | grep "max_file_descriptors" 我有这个输出:

"max_file_descriptors" : 65535,
"max_file_descriptors" : 65535,

到我已经拥有的文件/etc/security/limit.conf:

elasticsearch - nofile 65535
elasticsearch - memlock unlimited

如果我检查索引的状态,我有一些索引 RED....因此,logstash 出错并全部崩溃

【问题讨论】:

    标签: elasticsearch logstash


    【解决方案1】:

    只需将 elasticsearch - nofile 设置为无限制。 并确保您与正确的用户一起运行。

    【讨论】:

    • 它不应该以 root 身份运行。你如何开始这个过程?无论如何,您可以更改 root 用户的限制以暂时解决它。
    • 从 root,“service elasticserach start”,但 root 的 ulimit 值为 1024,我已使用“ulimit -n 65535”将此值更改为 65535。现在想我只需要重启 ES 即可解决,或者从 elasticsearch 用户启动 ES
    • /etc/init.d/elasticsearch 中有 runas 属性:RUN_AS_USER=elasticsearch... 把限制改成无限制,你已经达到了 65k。
    • ES 当前使用 elasticsearch 用户运行...设置为 /etc/sysconfig/elasticsearch,所以我必须将 unlimited 设置为 /etc/security/limits.conf?
    • 尝试在limits.conf中将其更改为512000。您也可以使用 * 代替用户名,这样它就适用于所有用户。
    猜你喜欢
    • 2017-03-03
    • 2016-08-09
    • 2020-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-09-06
    • 2019-02-23
    相关资源
    最近更新 更多