3

ターミナルから、開いているファイルの説明の数を変更しようとしていますが、固執しません。端末から ulimit を変更するにはどうすればよいですか? 以下のように、ターミナルから uwsgi を実行すると、fd は 1024 になります。

ubuntu@ubuntu:/tmp$ uwsgi --loop gevent --socket :3031 --wsgi-file /home/ubuntu/workspace/rtbopsConfig/rtbServers/rtbAsyncServers/bottleServer.py --master --async 100 --listen 300 --processes 1
*** Starting uWSGI 1.2.1 (64bit) on [Sat May 12 05:24:25 2012] ***
compiled with version: 4.5.2 on 11 May 2012 03:42:53
detected number of CPU cores: 2
current working directory: /tmp
detected binary path: /usr/local/bin/uwsgi
your memory page size is 4096 bytes
detected max file descriptor number: 1024
async fd table size: 1024
allocated 103200 bytes (100 KB) for 100 cores per worker.
lock engine: pthread robust mutexes
uwsgi socket 0 bound to TCP address :3031 fd 3
Python version: 2.7.1+ (r271:86832, Apr 11 2011, 18:37:12)  [GCC 4.5.2]
*** Python threads support is disabled. You can enable it with --enable-threads ***
Python main interpreter initialized at 0xd9bfd0
your server socket listen backlog is limited to 300 connections
*** Operational MODE: async ***
WSGI app 0 (mountpoint='') ready in 8 seconds on interpreter 0xd9bfd0 pid: 17688 (default app)
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 17688)
spawned uWSGI worker 1 (pid: 17742, cores: 100)
*** running gevent loop engine [addr:0x4503f0] ***
!!! Running gevent without threads IS NOT recommended, enable them with --enable-threads !!!
4

1 に答える 1

5

Nginx のファイル記述子の数を増やそうとしたときに、同様の問題が発生しました。www-data ユーザーの/etc/security/limits.confを変更する必要がnofileありました。

www-data    hard    nofile    16384
www-data    soft    nofile    16384

この変更の後、ulimit はまだ 1024 の制限を示していました。解決策は、 /etc/pam.d/suで *pam_limits* を有効にすることでした。次の行のコメントを外しました。

session    required    pam_limits.so

この値を変更しても再起動は必要ありませんでした。もう一度 www-data としてログインしただけです。さて、実行ulimit -aすると値が明らかになりました16384.

お役に立てれば。

于 2012-09-10T10:49:53.100 に答える