Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
Braid
V2EX  ›  Linux

最近在处理一批日志,然后 macbook 下搭建了个 es,发现日志量很大的情况下启动就会爆“Too many open files in system”...

  •  
  •   Braid · Mar 28, 2017 · 4328 views
    This topic created in 3332 days ago, the information mentioned may be changed or developed.
    最近在处理一批日志,然后 macbook 下搭建了个 es ,发现日志量很大的情况下启动就会爆“ Too many open files in system ”,网上查了很多方法都没得到解决。我的是 2015 款的 macbookpro ( 8G 内存+ 256GB ),目前我尝试的方法是 ulimit -Sn 10240

    求除了换电脑外的解决方法。。。
    13 replies    2017-03-29 14:19:40 +08:00
    Braid
        1
    Braid  
    OP
       Mar 28, 2017
    You can increase the limits (at your own risk) with:

    sysctl -w kern.maxfiles=20480 (or whatever number you choose)
    sysctl -w kern.maxfilesperproc=18000 (or whatever number you choose)

    这个貌似可以临时解决。
    royantar
        2
    royantar  
       Mar 28, 2017
    10240 还是小吧, es 官方稳定建议 65536 或更高。

    https://www.elastic.co/guide/en/elasticsearch/reference/5.2/file-descriptors.html
    leopku
        3
    leopku  
       Mar 28, 2017
    在 vagrant 或 docker 里跑 es ,然后把 vagrant 或 es 的 limit 调到最大
    kmahyyg
        4
    kmahyyg  
       Mar 28, 2017 via Android
    ulimit -n 51200 这是最低
    janxin
        5
    janxin  
       Mar 28, 2017
    你换个电脑也是这问题,这个是系统的最大打开句柄上限默认设置太低,改大点就好了,方法上面都提供过了。

    Linux 服务器高并发下如果不改配置,一样也会遇到这问题 23333
    wweir
        6
    wweir  
       Mar 29, 2017 via Android
    直接上 1048576 这个上限
    Braid
        7
    Braid  
    OP
       Mar 29, 2017
    @kmahyyg macbook 我那个电脑 ulimit -n 10240 就是极限了。。。之后就会报错
    KIDJourney
        8
    KIDJourney  
       Mar 29, 2017
    @Braid sudo
    eimsteim
        9
    eimsteim  
       Mar 29, 2017
    弱弱问一句, es 是什么?
    Braid
        10
    Braid  
    OP
       Mar 29, 2017
    @KIDJourney 试过 sudo 了
    Braid
        11
    Braid  
    OP
       Mar 29, 2017
    @wweir 这可以,我保险设置到了:

    sysctl -w kern.maxfiles=81920
    sysctl -w kern.maxfilesperproc=40960
    Immortal
        12
    Immortal  
       Mar 29, 2017
    这个 linux 下不就是
    ulimit -n 65535
    zhyt1985
        13
    zhyt1985  
       Mar 29, 2017
    @eimsteim ElasticSearch
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4283 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 57ms · UTC 00:08 · PVG 08:08 · LAX 17:08 · JFK 20:08
    ♥ Do have faith in what you're doing.