营销型网站建设设计网站建设合同内容与结构
服务器在负载达到一定量时会报error: too many open files,这是inux默认只有1024的最大句柄数需要进行修改和配置
配置攻略如下:
修改ubuntu 16.04 的文件句柄限制
 一、
 查看当前句柄数方法:
 查看当前系统最大能设置的句柄值
 cat /proc/sys/fs/file-max
 二、
 查看当前设置的句柄值
 ulimit -n
 三、
 修改方法:
 1. vi /etc/sysctl.conf
 文件末尾新增:
 fs.file-max = 131072
 net.core.somaxconn = 32768
 2. 执行命令:
 sudo sysctl -p
 3. vi /etc/security/limits.conf
 文件末尾新增:
 * soft nproc 131072
 * hard nproc 131072
 * soft nofile 131072
 * hard nofile 131072
 root soft nproc 131072
 root hard nproc 131072
 root soft nofile 131072
 root hard nofile 131072
 4. vi /etc/pam.d/common-session
 文件末尾新增:
 session required pam_limits.so
 5. 执行命令:
 ulimit -n 131072
 6. 重启reboot,查看是否修改生效,重启后命令 ulimit -n, 查看是否已修改
