Linux socket连接数(file descriptor)

xiaoxiao2021-02-28  89

系统全局设置

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就可以了。

转载请注明原文地址: https://www.6miu.com/read-46708.html

最新回复(0)