今天经理让我优化liunx 的性能,修改下文件打开数。以下是我修改配置:

注意:

   1、root 用户是不受文件打开数的限制,虽然显示是1024,请问liunx 中谁的权限要比root 用户还要大?

   2、我设置的是全部的用户,不是单个用户

步骤一:vi /etc/security/limits.conf

文件增添内容:

* soft nproc 2047

* hard nproc 16384

* soft nofile 1024

*  hard nofile 65536

* hard stack 10240

步骤二: vi /etc/profile

文件增添内容:

if [ $USER = "*" ]; then

if [ $SHELL = "/bin/ksh" ]; then

ulimit -p 16384

ulimit -n 65536

else

ulimit -u 16384 -n 65536

fi

umask 022

fi

步骤三:使文件 /etc/profile 生效 ,命令:source /etc/profile

步骤四:退出当前登录,重新登录,使用命令:ulimit -n 可以查看当前的文件数

结束:如果有不足,请多多指教!

 

posted on 2017-03-08 17:20  代码痕迹  阅读(319)  评论(0编辑  收藏  举报