ubuntu - 从 ubuntu 的终端,更改文件描述符编号的 ulimit

标签 ubuntu uwsgi ulimit

在终端上,我试图更改打开的文件描述的数量,但它们不会保留。如何从终端更改 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 !!!

最佳答案

我在尝试增加 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

希望这对您有所帮助。

关于ubuntu - 从 ubuntu 的终端,更改文件描述符编号的 ulimit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10558876/

相关文章:

python - uwsgi_param 和 proxy_set_header 的区别

java - ULIMIT:如何永久设置限制

ubuntu - 将 ulimit 设置得非常高有什么缺点吗?

c++ - setrlimit 不适用于 OS X Maverick 和 Yosemite

python - 在 Python3 ubuntu 上安装 tkinter

python - 如何将 Django 作为服务运行?

django - Nginx、uwsgi、django、ubuntu 16 带有静态文件的问题

python - uWSGI - Django Admin 的不同 Harakiri 超时

ubuntu - 在//tensorflow/core/grappler/costs :utils: when trying to build Tensorflow with GPU support 中的可配置属性 "deps"上的非法模糊匹配

linux - Flutter 发布到 Linux