2017-09-12 7 views
1

私は、ロードバランサーをしたと私は、この種のエラーを取得:nginxのロードバランサー開いているファイルが多すぎます

2017/09/12 11:18:38 [crit] 22348#22348: accept4() failed (24: Too many open files) 
2017/09/12 11:18:38 [alert] 22348#22348: *4288962 socket() failed (24: Too many open files) while connecting to upstream, client: x.x.x.x, server: example.com, request: "GET /xxx.jpg HTTP/1.1", upstream: "http://y.y.y.y:80/xxx.jpg", host: "example.com", referrer: "https://example.com/some-page" 
2017/09/12 11:18:38 [crit] 22348#22348: *4288962 open() "/usr/local/nginx/html/50x.html" failed (24: Too many open files), client: x.x.x.x, server: example.com, request: "GET /xxx.jpg HTTP/1.1", upstream: "http://y.y.y.y:80/xxx.jpg", host: "example.com", referrer: "https://example.com/some-page" 

nginxのバージョン:nginxの/ 1.10.1

Osの:Debian GNU/Linuxの面白いことが必ずしもエラーになるわけではありません。ほとんどの場合、私は30〜50行のエラーがあり、5〜10分は何も得られません。エラーが再び来ているいったんそして...ここ

は私nginx.confです:

user     www-data; 
pid      /usr/local/nginx/nginx.pid; 
worker_processes  auto; 

error_log    /var/log/nginx/error.log; 

events { 
    worker_connections 30000; 
} 

http { 
    include    mime.types; 
    default_type  application/octet-stream; 

    fastcgi_buffers 16 16k; 
    fastcgi_buffer_size 32k; 

    proxy_buffer_size 128k; 
    proxy_buffers 4 256k; 
    proxy_busy_buffers_size 256k; 
    client_max_body_size 500m; 
    rewrite_log on; 

    log_format   main '$remote_addr - "$proxy_add_x_forwarded_for" - [$time_local] "$request" ' 
           '$status $body_bytes_sent "$http_referer" ' 
           '"$http_user_agent" "$backend" ' 
           'rt=$request_time uct="$upstream_connect_time" ' 
           'uht="$upstream_header_time" urt="$upstream_response_time"'; 

    access_log   /var/log/nginx/access.log main; 

    sendfile   on; 
    tcp_nopush   on; 
    tcp_nodelay   on; 
    keepalive_timeout 65; 

    geoip_country /etc/nginx/geodb/GeoIP.dat; 
    geoip_city  /etc/nginx/geodb/GeoLiteCity.dat; 

    include    /etc/nginx/loadbalancer/loadbalancer.conf; 

} 

ともいくつかの情報:

$ ulimit -Hn 
65536 
$ ulimit -Sn 
65536 
$ sysctl fs.file-nr 
fs.file-nr = 2848 0 70000 

それは価値がある場合、私は知りませんこのロードバランサは雲の後ろにあります。私はnginx.confに次の行を追加しました

+0

あなたがチェックしている 'ulimit'はおそらくrootユーザーです。 'nginx'ワーカーを' www-data'として実行するので、そのユーザのulimitをチェックする必要があります。 'sudo -u www-data bash -c" ulimit "' –

+0

@TarunLalwaniを使ってみてください: 'unlimited' – MrRP

答えて

0

worker_rlimit_nofile 20000; 

は、今では動作しますが、私は変更以来、すべてのエラーを得ることはありません。

私はそれが同じ問題を抱えていると助けてくれることを願っています。

関連する問題