方法一:

[root@bogon ~]# vi /etc/systemd/system.conf
[root@bogon ~]# cat /etc/systemd/system.conf
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
#
# Entries in this file show the compile time defaults.
# You can change settings by editing this file.
# Defaults can be restored by simply deleting this file.
#
# See systemd-system.conf(5) for details. [Manager]
#LogLevel=info
#LogTarget=journal-or-kmsg
#LogColor=yes
#LogLocation=no
#DumpCore=yes
#CrashShell=no
#ShowStatus=yes
#CrashChVT=1
#CPUAffinity=1 2
#JoinControllers=cpu,cpuacct net_cls,net_prio
#RuntimeWatchdogSec=0
#ShutdownWatchdogSec=10min
#CapabilityBoundingSet=
#SystemCallArchitectures=
#TimerSlackNSec=
#DefaultTimerAccuracySec=1min
#DefaultStandardOutput=journal
#DefaultStandardError=inherit
#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s
#DefaultRestartSec=100ms
#DefaultStartLimitInterval=10s
#DefaultStartLimitBurst=5
#DefaultEnvironment=
#DefaultCPUAccounting=no
#DefaultBlockIOAccounting=no
#DefaultMemoryAccounting=no
#DefaultLimitCPU=
#DefaultLimitFSIZE=
#DefaultLimitDATA=
#DefaultLimitSTACK=
#DefaultLimitCORE=
#DefaultLimitRSS=
#DefaultLimitNOFILE=
DefaultLimitNOFILE=1024000 #这里需要修改
#DefaultLimitAS=
#DefaultLimitNPROC=
DefaultLimitNPROC=1024000 #这里也需要修改
#DefaultLimitMEMLOCK=
#DefaultLimitLOCKS=
#DefaultLimitSIGPENDING=
#DefaultLimitMSGQUEUE=
#DefaultLimitNICE=
#DefaultLimitRTPRIO=
#DefaultLimitRTTIME=
[root@bogon ~]# ulimit -a #修改之后没有重启
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 3791
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024 #还是默认值1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 3791
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[root@bogon ~]# reboot
Connection to 192.168.1.107 closed by remote host.
Connection to 192.168.1.107 closed.
root@BP:~# ssh 192.168.1.107 #我使用的是密钥登录,所以不用再输入密码
Last login: Mon Jun 26 15:38:21 2017 from 192.168.1.100
u[root@bogon ~]# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 3791
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024000 #重启后生效了
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 1024000
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
[root@bogon ~]#

方法二:

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. WM_COPYDATA进程间通信方案
  2. .htaccess保护目录与文件
  3. wordpress中如何禁止或者屏蔽更新提示
  4. python中列表和字典常用方法和函数
  5. 历时一周,unity3d+xtion打造我的第一个休闲体感小游戏《空降奇兵》
  6. Undefined property: Illuminate\Database\Eloquent\Builder
  7. 删除主目录下的.ssh目录下文件对boot2docker启动影响
  8. 数位DP入门之hdu 3652 B-number
  9. 在Apache上部署Django
  10. Git管理工具对照(GitBash、EGit、SourceTree)
  11. SQL模板资源管理器,你用了吗?
  12. 2019-1-17 前言 C#高级编程(第11版)
  13. Mysql 字符串指定位置插入空格
  14. js:苹果手机页面返回,数据不刷新问题
  15. [转帖]Marvell兵败中国4G 创始人去职未来几何
  16. Docker简介及Linux下安装
  17. day4_处理json
  18. Vue--Vue.nextTick()的使用
  19. PHPCMS 栏目添加字段和修改描述textarea变成fceditor编辑器
  20. python知识(3)----正则表达式

热门文章

  1. selenium登录界面,创建表单并填写提交
  2. asp.net mvc 获取ajax的 request payload 参数
  3. 4.7 C++ dynamic_cast操作符
  4. 3.4 C++名字隐藏
  5. FutureTask
  6. Spring学习三
  7. transform带来的坑
  8. UIIimageView读取图片的两种方式及动画的执行
  9. mysql cast
  10. ChinaCock界面控件介绍-CCLoadingIndicator