方法一:

  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. sqlserver查询父子级关系

    自上向下的查询方法,查询出自身以及所有的子孙数据: --自上往下搜索 ;with maco as ( union all select t.* from ty_Dictionary t,maco m ...

  2. windows7环境下java jdk的配置

    第一步: 肯定是先下载好java jdk啦~~ 网址在这里:http://www.oracle.com/technetwork/java/javase/downloads/index.html 打开这 ...

  3. VSTO - 使用Excel加载项生成表和图表

    此示例显示如何创建Excel的加载项,使用户可以在其工作表中选择库存符号,然后生成一个新工作表,显示库存的历史性能. 工作表包含数据表和图表. 介绍Excel加载项通常不知道工作表包含什么.典型的加载 ...

  4. HashMap和Hashtable有什么区别?

    HashMap和Hashtable都是实现Map接口的,但是: 1.HashMap允许键和值都是null的,而Hashtable不允许键和值为null 2.Hashtable是同步的,而HashMap ...

  5. minidebug学习分析 01 基本框架

    0x01  基本框架  基本框架就是CreateProcess启动目标程序,再通过调试事件DEBUG_EVENT在调试循环中监控程序的行为.  (1)CreatProcess BOOL CreateP ...

  6. powerdesigner导出sql时报错 Generation aborted due to errors detected during the verification of the model.

    powerdesigner导出sql时报错 Generation aborted due to errors detected during the verification of the model ...

  7. 牛客oi测试赛 二 B 路径数量

    题目描述 给出一个 n * n 的邻接矩阵A. A是一个01矩阵 . A[i][j]=1表示i号点和j号点之间有长度为1的边直接相连. 求出从 1 号点 到 n 号点长度为k的路径的数目. 输入描述: ...

  8. AbstractBootstrap.bind()

    ------------------headContext也就是pipeline最开头的那个handlercontext中的bind方法@Override public void bind( Chan ...

  9. dos命令:网络相关命令

    网络相关命令 一.Arp命令 1.介绍 ​ 显示和修改地址解析协议(ARP)使用的“IP 到物理”地址转换表. 2.语法 ARP -s inet_addr eth_addr [if_addr] ARP ...

  10. 图片 100%显示. img 全部显示.

    让每个图片 都铺满 ,同样的大小;    只要给 img 设置 固定的高度, 宽度就可以 了. ----------------------- html: <div class="co ...