从ubuntu的终端中,更改文件描述符编号的ulimit [英] From terminal in ubuntu, change ulimit for file descriptor number

查看:317
本文介绍了从ubuntu的终端中,更改文件描述符编号的ulimit的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在终端前,我尝试更改打开的文件描述的数量,它们将不会粘住.如何从终端更改ulimit?根据下面的内容,当我从终端运行uwsgi时,fd在1024.

Fron the terminal I am trying to change the number of file descriptions open and they will not stick. How, from the terminal do I change the ulimit? Per the below, when I run uwsgi from the terminal, fd are at 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:

I had a similar issue when trying to raise the number of file descriptors for Nginx. I had to change nofile in /etc/security/limits.conf for the www-data user:

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

此更改之后,ulimit仍显示限制为1024.解决方案是在/etc/pam.d/su 中启用* pam_limits *.我只是取消注释该行:

After this change ulimit still showed a limit of 1024. The solution was to enable *pam_limits* in /etc/pam.d/su. I just uncommented the line:

session    required    pam_limits.so

更改此值不需要重新启动,我只是再次以www-data身份登录.现在,运行ulimit -a会显示值16384.

Changing this value didn't require a restart, I just logged in as www-data again. Now, running ulimit -a revealed the value 16384.

希望这会有所帮助.

这篇关于从ubuntu的终端中,更改文件描述符编号的ulimit的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆