Centos7修改默认最大文件打开数
方法一:
[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
Centos7修改默认最大文件打开数的更多相关文章
- [转帖]备忘:CentOS-7 使用systemctl 管理的服务,文件打开数上限1024要改
备忘:CentOS-7 使用systemctl 管理的服务,文件打开数上限1024要改 https://blog.csdn.net/toontong/article/details/50440272 ...
- Linux下设置最大文件打开数nofile及nr_open、file-max
在开发运维的时候我们常常会遇到类似“Socket/File: Can’t open so many files”,“无法打开更多进程”,或是coredump过大等问题,这些都可以设置资源限制来解决.今 ...
- 【Linux命令】ulimit设置最大文件打开数
一.简介 在Linux下有时会遇到Socket/File : Can't open so many files的问题.其实Linux是有文件句柄限制的,而且Linux默认一般都是1024(阿里云主机默 ...
- ulimit 命令详解 socket查看linux最大文件打开数
ulimit 命令详解 Linux对于每个用户,系统限制其最大进程数.为提高性能,可以根据设备资源情况,设置各linux 用户的最大进程数 可以用ulimit -a 来显示当前的各种用户进程限 ...
- linux最大文件打开数和swap限制
linux最大文件打开数和swap限制 逑熙 关注 2017.07.24 15:39* 字数 388 阅读 314评论 0喜欢 0 linux 2.6+的核心会使用硬盘的一部分做为SWAP分区,用 ...
- mysql 系统用户最大文件打开数限制
纸上得来终觉浅,绝知此事多宕机...记录一下自己很蠢的一次故障处理过程. 上周的时候,一个刚上线的系统又开始反映登不上了,因为最近这个系统也老是出现这个问题,开发也一直在找问题中,所以也没太在意.于是 ...
- 调整Linux的最大文件打开数
要调整一下Linux的最大文件打开数,否则squid在高负载时执行性能将会很低.另外,在Linux下面部署应用时,有时候会遇上 Socket/File:Can’t open so many files ...
- 【SecureCRT配置】修改默认卷屏行数当做一个操作,屏幕输出有上百行,当需要将屏幕回翻时,这个设置会有很大帮助,默认为500行,可以改为10000行,不用担心找不到了。 选项 => 全局选项 => Default Session => Edit Default Settings => Terminal => Emulation => Scrollback 修改为32000。
SecureCRT配置屏幕内容输出到log文件 SecureCRT看不到前几分钟操作的内容,或者想把通过vi命令查看的日志输出到log文件(在懒得下载日志文件的情况下),所以接下来就这样操作: 文件保 ...
- linux 最大文件打开数
配置文件 vim /etc/security/limits.conf # /etc/security/limits.conf##This file sets the resource limits ...
随机推荐
- day03 字符串
今日学习 1.python的基本数据回顾 2.int--数字类型 3.bool值 取值只有True False bool值没有操作 4.字符串 1.python的基本数据回顾 1)int =>整 ...
- MariaDB的线程及连接
转自 linux公社 今天在这里介绍一下确认mariaDB(和MySQL一样)的链接数及线程数的方法.MariaDB和MySQL有什么不一样,现在还没有弄清楚. 这是减少数据库的负载,并能提高数据库运 ...
- String和StringBuffer互相转换
String:不可变 StringBuffer:可变 StringBuffer 上的任何修改性的操作都是在同一个字符数组上进行的,所以修改其中任一个值 另一个的值也会随着改变! StringBuffe ...
- Linux使用定时器timerfd 和 eventfd接口实现进程线程通信
body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...
- Cracking The Coding Interview 1.8
//Assume you have a method isSubstring which checks if one word is a substring of another. //Given t ...
- SQL-39 使用索引
题目描述 针对salaries表emp_no字段创建索引idx_emp_no,查询emp_no为10005, 使用强制索引.CREATE TABLE `salaries` (`emp_no` int( ...
- Centos7部署open-falcon 0.2
参考: https://www.cnblogs.com/straycats/p/7199209.html http://book.open-falcon.org/zh_0_2/quick_instal ...
- jdk1.8使用的url和driverName的改变
#dataSource configure connection.url=jdbc:mysql://localhost:3306/shiro?useSSL=false&serverTimezo ...
- JAVA 中的MessageDigest类和Mac类的使用
MessageDigest 消息摘要 例子: MD5加密: try{ MessageDigest md5 = MessageDigest.getInstance("MD5"); m ...
- Linux 安装最新版本python3
新安装了Linux系统(CentOS 6),发现已安装的python版本是2.6. 在网上搜索研究之后总结了一下怎么在保留python2的同时安装最新版的python3. 1. 查看 Python 的 ...