• 增加CentOS File Descriptors


    在使用CentOS做server的时候有时会碰到server拒绝client连接的情况,client会受到connection reset by peer等错误,究其原因应该是server默认的file descriptor为1024,此时已经超过了1024,为安全起见server拒绝服务所导致的。
    增加file descriptor的操作如下:
    一、临时增加file descriptor
      ulimit -n 4096
    二、永久增加file descriptor
      2.1 # vi /etc/sysctl.conf
      2.2 增加 fs.file-max = 100000
      2.3 重启或者执行 # sysctl -p
      2.4 # vi /etc/security/limits.conf
      2.5 增加 *       -       nofile  100000
      2.6 通过ulimit -n来校验file descriptor

    参考资料:
      http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/
      http://sdb.open-xchange.com/node/35
      http://thedaneshproject.com/posts/how-to-increase-total-file-descriptors-count-on-linux/
      http://www.centos.org/docs/5/html/CDS/install/8.0/Installation_Guide-Support-Platforms.html
      
      

  • 相关阅读:
    回调函数 协程
    网络编程 之线程
    并发编程 之进程相关
    并发编程的理论 python中实现多进程
    基于tcp的粘包处理终极版本
    基于socket的网络编程
    数据分析
    zabbix从入门到放弃
    Linux
    Django
  • 原文地址:https://www.cnblogs.com/Jerryshome/p/2261947.html
Copyright © 2020-2023  润新知