免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 956 | 回复: 0
打印 上一主题 下一主题

[Linux资讯] ulimit 命令选项表 [复制链接]

求职 : Linux运维
论坛徽章:
203
拜羊年徽章
日期:2015-03-03 16:15:432015年辞旧岁徽章
日期:2015-03-03 16:54:152015年迎新春徽章
日期:2015-03-04 09:57:092015小元宵徽章
日期:2015-03-06 15:58:182015年亚洲杯之约旦
日期:2015-04-05 20:08:292015年亚洲杯之澳大利亚
日期:2015-04-09 09:25:552015年亚洲杯之约旦
日期:2015-04-10 17:34:102015年亚洲杯之巴勒斯坦
日期:2015-04-10 17:35:342015年亚洲杯之日本
日期:2015-04-16 16:28:552015年亚洲杯纪念徽章
日期:2015-04-27 23:29:17操作系统版块每日发帖之星
日期:2015-06-06 22:20:00操作系统版块每日发帖之星
日期:2015-06-09 22:20:00
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2016-02-24 14:03 |只看该作者 |倒序浏览
ulimit选项表


Linux资源使用配置文件 /etc/security/limits.conf

    user@db-2:~$ cat /etc/security/limits.conf   
    # /etc/security/limits.conf  
    #  
    #Each line describes a limit for a user in the form:  
    #  
    #<domain>        <type>  <item>  <value>  
    #  
    #Where:  
    #<domain> can be:  
    #        - an user name  
    #        - a group name, with @group syntax  
    #        - the wildcard *, for default entry  
    #        - the wildcard %, can be also used with %group syntax,  
    #                 for maxlogin limit  
    #  
    #<type> can have the two values:  
    #        - "soft" for enforcing the soft limits # 软限制,必须比硬限制的值要小  
    #        - "hard" for enforcing hard limits     # 硬限制  
    #  
    #<item> can be one of the following:  
    #        - core - limits the core file size (KB)  
    #        - data - max data size (KB)  
    #        - fsize - maximum filesize (KB)  
    #        - memlock - max locked-in-memory address space (KB)  
    #        - nofile - max number of open files    # 最大打开的文件数(以文件描叙符,file descriptor计数)  
    #        - rss - max resident set size (KB)  
    #        - stack - max stack size (KB)  
    #        - cpu - max CPU time (MIN)  
    #        - nproc - max number of processes  
    #        - as - address space limit  
    #        - maxlogins - max number of logins for this user  
    #        - maxsyslogins - max number of logins on the system  
    #        - priority - the priority to run user process with  
    #        - locks - max number of file locks the user can hold  
    #        - sigpending - max number of pending signals  
    #        - msgqueue - max memory used by POSIX message queues (bytes)  
    #        - nice - max nice priority allowed to raise to  
    #        - rtprio - max realtime priority  
    #  
    #<domain>      <type>  <item>         <value>  
    #  
    root            soft    nofile          200000  
    root            hard    nofile          200000  
    admin           hard    nofile          65536  
    admin           soft    nofile          65536  
    # End of file  

每行的格式:
用户名/用户组    类型(硬限制、软限制)   选项     值

比如很多朋友可能在使用mysql的时候遇到two many open files的错误,此时便可以通过将运行mysqld的用户的 nofile(最大打开文件数)这个值增大一点,例如
db_running_user      -      nofile    设定一个合理的值  
注意上面的第二列 ‘-’表示hard和soft,可以显示的为soft和hard写两行

我这只是举一个例子,这个文件还可以配置很多资源的使用,但是一般的情况下用默认的就行,当你有特殊需求或者自己对这些参数的来龙去脉又相当了解,你可以去改这些默认的参数,查看当前用户的这些资源使用限制情况可以使用 ulimit -a(查看ulimit的使用方法,用man ulimit无效,可以用help ulimit)

那么对它的修改什么时候生效呢?每次重新login的时候生效,至于原因则是我参考的那篇文章里面说了。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP