方法一:

  1. [root@bogon ~]# vi /etc/systemd/system.conf
  2. [root@bogon ~]# cat /etc/systemd/system.conf
  3. # This file is part of systemd.
  4. #
  5. # systemd is free software; you can redistribute it and/or modify it
  6. # under the terms of the GNU Lesser General Public License as published by
  7. # the Free Software Foundation; either version 2.1 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # Entries in this file show the compile time defaults.
  11. # You can change settings by editing this file.
  12. # Defaults can be restored by simply deleting this file.
  13. #
  14. # See systemd-system.conf(5) for details.
  15. [Manager]
  16. #LogLevel=info
  17. #LogTarget=journal-or-kmsg
  18. #LogColor=yes
  19. #LogLocation=no
  20. #DumpCore=yes
  21. #CrashShell=no
  22. #ShowStatus=yes
  23. #CrashChVT=1
  24. #CPUAffinity=1 2
  25. #JoinControllers=cpu,cpuacct net_cls,net_prio
  26. #RuntimeWatchdogSec=0
  27. #ShutdownWatchdogSec=10min
  28. #CapabilityBoundingSet=
  29. #SystemCallArchitectures=
  30. #TimerSlackNSec=
  31. #DefaultTimerAccuracySec=1min
  32. #DefaultStandardOutput=journal
  33. #DefaultStandardError=inherit
  34. #DefaultTimeoutStartSec=90s
  35. #DefaultTimeoutStopSec=90s
  36. #DefaultRestartSec=100ms
  37. #DefaultStartLimitInterval=10s
  38. #DefaultStartLimitBurst=5
  39. #DefaultEnvironment=
  40. #DefaultCPUAccounting=no
  41. #DefaultBlockIOAccounting=no
  42. #DefaultMemoryAccounting=no
  43. #DefaultLimitCPU=
  44. #DefaultLimitFSIZE=
  45. #DefaultLimitDATA=
  46. #DefaultLimitSTACK=
  47. #DefaultLimitCORE=
  48. #DefaultLimitRSS=
  49. #DefaultLimitNOFILE=
  50. DefaultLimitNOFILE=1024000 #这里需要修改
  51. #DefaultLimitAS=
  52. #DefaultLimitNPROC=
  53. DefaultLimitNPROC=1024000 #这里也需要修改
  54. #DefaultLimitMEMLOCK=
  55. #DefaultLimitLOCKS=
  56. #DefaultLimitSIGPENDING=
  57. #DefaultLimitMSGQUEUE=
  58. #DefaultLimitNICE=
  59. #DefaultLimitRTPRIO=
  60. #DefaultLimitRTTIME=
  61. [root@bogon ~]# ulimit -a #修改之后没有重启
  62. core file size (blocks, -c) 0
  63. data seg size (kbytes, -d) unlimited
  64. scheduling priority (-e) 0
  65. file size (blocks, -f) unlimited
  66. pending signals (-i) 3791
  67. max locked memory (kbytes, -l) 64
  68. max memory size (kbytes, -m) unlimited
  69. open files (-n) 1024 #还是默认值1024
  70. pipe size (512 bytes, -p) 8
  71. POSIX message queues (bytes, -q) 819200
  72. real-time priority (-r) 0
  73. stack size (kbytes, -s) 8192
  74. cpu time (seconds, -t) unlimited
  75. max user processes (-u) 3791
  76. virtual memory (kbytes, -v) unlimited
  77. file locks (-x) unlimited
  78. [root@bogon ~]# reboot
  79. Connection to 192.168.1.107 closed by remote host.
  80. Connection to 192.168.1.107 closed.
  81. root@BP:~# ssh 192.168.1.107 #我使用的是密钥登录,所以不用再输入密码
  82. Last login: Mon Jun 26 15:38:21 2017 from 192.168.1.100
  83. u[root@bogon ~]# ulimit -a
  84. core file size (blocks, -c) 0
  85. data seg size (kbytes, -d) unlimited
  86. scheduling priority (-e) 0
  87. file size (blocks, -f) unlimited
  88. pending signals (-i) 3791
  89. max locked memory (kbytes, -l) 64
  90. max memory size (kbytes, -m) unlimited
  91. open files (-n) 1024000 #重启后生效了
  92. pipe size (512 bytes, -p) 8
  93. POSIX message queues (bytes, -q) 819200
  94. real-time priority (-r) 0
  95. stack size (kbytes, -s) 8192
  96. cpu time (seconds, -t) unlimited
  97. max user processes (-u) 1024000
  98. virtual memory (kbytes, -v) unlimited
  99. file locks (-x) unlimited
  100. [root@bogon ~]#

  101. 方法二:

ulimit只能做临时修改,重启后失效。
可以加入
ulimit -SHn 65535
到 /etc/rc.local 每次启动启用。

终极解除 Linux 系统的最大进程数和最大文件打开数限制:
vim /etc/security/limits.conf
# 添加如下的行
* soft nproc 11000
* hard nproc 11000
* soft nofile 655350
* hard nofile 655350

  1.  

Centos7修改默认最大文件打开数的更多相关文章

  1. [转帖]备忘:CentOS-7 使用systemctl 管理的服务,文件打开数上限1024要改

    备忘:CentOS-7 使用systemctl 管理的服务,文件打开数上限1024要改 https://blog.csdn.net/toontong/article/details/50440272 ...

  2. Linux下设置最大文件打开数nofile及nr_open、file-max

    在开发运维的时候我们常常会遇到类似“Socket/File: Can’t open so many files”,“无法打开更多进程”,或是coredump过大等问题,这些都可以设置资源限制来解决.今 ...

  3. 【Linux命令】ulimit设置最大文件打开数

    一.简介 在Linux下有时会遇到Socket/File : Can't open so many files的问题.其实Linux是有文件句柄限制的,而且Linux默认一般都是1024(阿里云主机默 ...

  4. ulimit 命令详解 socket查看linux最大文件打开数

    ulimit 命令详解     Linux对于每个用户,系统限制其最大进程数.为提高性能,可以根据设备资源情况,设置各linux 用户的最大进程数 可以用ulimit -a 来显示当前的各种用户进程限 ...

  5. linux最大文件打开数和swap限制

    linux最大文件打开数和swap限制   逑熙 关注 2017.07.24 15:39* 字数 388 阅读 314评论 0喜欢 0 linux 2.6+的核心会使用硬盘的一部分做为SWAP分区,用 ...

  6. mysql 系统用户最大文件打开数限制

    纸上得来终觉浅,绝知此事多宕机...记录一下自己很蠢的一次故障处理过程. 上周的时候,一个刚上线的系统又开始反映登不上了,因为最近这个系统也老是出现这个问题,开发也一直在找问题中,所以也没太在意.于是 ...

  7. 调整Linux的最大文件打开数

    要调整一下Linux的最大文件打开数,否则squid在高负载时执行性能将会很低.另外,在Linux下面部署应用时,有时候会遇上 Socket/File:Can’t open so many files ...

  8. 【SecureCRT配置】修改默认卷屏行数当做一个操作,屏幕输出有上百行,当需要将屏幕回翻时,这个设置会有很大帮助,默认为500行,可以改为10000行,不用担心找不到了。 选项 => 全局选项 => Default Session => Edit Default Settings => Terminal => Emulation => Scrollback 修改为32000。

    SecureCRT配置屏幕内容输出到log文件 SecureCRT看不到前几分钟操作的内容,或者想把通过vi命令查看的日志输出到log文件(在懒得下载日志文件的情况下),所以接下来就这样操作: 文件保 ...

  9. linux 最大文件打开数

    配置文件 vim /etc/security/limits.conf   # /etc/security/limits.conf##This file sets the resource limits ...

随机推荐

  1. day03 字符串

    今日学习 1.python的基本数据回顾 2.int--数字类型 3.bool值 取值只有True False bool值没有操作 4.字符串 1.python的基本数据回顾 1)int =>整 ...

  2. MariaDB的线程及连接

    转自 linux公社 今天在这里介绍一下确认mariaDB(和MySQL一样)的链接数及线程数的方法.MariaDB和MySQL有什么不一样,现在还没有弄清楚. 这是减少数据库的负载,并能提高数据库运 ...

  3. String和StringBuffer互相转换

    String:不可变 StringBuffer:可变 StringBuffer 上的任何修改性的操作都是在同一个字符数组上进行的,所以修改其中任一个值 另一个的值也会随着改变! StringBuffe ...

  4. Linux使用定时器timerfd 和 eventfd接口实现进程线程通信

    body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...

  5. Cracking The Coding Interview 1.8

    //Assume you have a method isSubstring which checks if one word is a substring of another. //Given t ...

  6. SQL-39 使用索引

    题目描述 针对salaries表emp_no字段创建索引idx_emp_no,查询emp_no为10005, 使用强制索引.CREATE TABLE `salaries` (`emp_no` int( ...

  7. Centos7部署open-falcon 0.2

    参考: https://www.cnblogs.com/straycats/p/7199209.html http://book.open-falcon.org/zh_0_2/quick_instal ...

  8. jdk1.8使用的url和driverName的改变

    #dataSource configure connection.url=jdbc:mysql://localhost:3306/shiro?useSSL=false&serverTimezo ...

  9. JAVA 中的MessageDigest类和Mac类的使用

    MessageDigest 消息摘要 例子: MD5加密: try{ MessageDigest md5 = MessageDigest.getInstance("MD5"); m ...

  10. Linux 安装最新版本python3

    新安装了Linux系统(CentOS 6),发现已安装的python版本是2.6. 在网上搜索研究之后总结了一下怎么在保留python2的同时安装最新版的python3. 1. 查看 Python 的 ...