linux服务连接数的修改(例nginx)

1、确认nginx配置文件进程数、连接数、文件限制数有设置
2、在文件/etc/security/limits.conf 后加上

  • soft nofile 65535
  • hard nofile 65535
    3、root下运行以下命令
    ulimit -n 65535;
    ip a;
    sh /usr/local/keepalived/sbin/ka.sh stop;
    ps -ef | grep keep;
    ps -ef | grep nginx;
    /usr/local/nginx/sbin/nginx -s stop;
    ps -ef | grep nginx;
    /usr/local/nginx/sbin/nginx;
    ps -ef | grep nginx;
    sh /usr/local/keepalived/sbin/ka.sh start;
    ps -ef | grep keep;
    ip a;
    文件打开数的修改
    cat /proc/$(ps -ef | grep nginx | grep master | awk '{print KaTeX parse error: Expected 'EOF', got '}' at position 2: 2}̲')/limits | gre…(ps -ef | grep nginx | grep worker |head -n 1 | awk ‘{print $2}’)/limits | grep open;

猜你喜欢

转载自blog.csdn.net/qq_38774492/article/details/107930185