Linux socket连接数(file descriptor)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/sheismylife/article/details/76761417

系统全局设置

cat /proc/sys/fs/file-max

这是系统范围的限制,通常数字要比其他的大。


shell相关设置

用ulimit -a查看-n选项的数值

或者直接用ulimit -n查看

ulimit -n也可以临时设置,但必须是root帐号才行

配置文件

/etc/security/limits.conf 提供了修改的配置方法

采用domain/type/item的维度进行设置

也可以直接修改end of file一行后面

# End of file
 *           soft   nofile       1024000
 *           hard   nofile       1024000
 *           soft   nproc        102400
 *           hard   nproc        102400

这里我把nofile的soft和hard值都增加了一位0,达到100万以上。

不需要重新启动,只需要重新进入shell就可以了。


猜你喜欢

转载自blog.csdn.net/sheismylife/article/details/76761417