too many open files

350 阅读1分钟

查看系统文件描述符总数 ulimit -a

vim /etc/sysctl.conf
net.ipv4.tcp_max_tw_buckets = 6000
net.ipv4.ip_local_port_range = 1024    65000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_syncookies = 1
net.core.somaxconn = 655350
net.core.netdev_max_backlog = 655350
net.ipv4.tcp_max_orphans = 655350
net.ipv4.tcp_max_syn_backlog = 655350
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_fin_timeout = 1
net.ipv4.tcp_keepalive_time = 30
net.ipv4.tcp_abort_on_overflow = 1
sysctl -p

查看进程最大文件描述符
查找进程pid ps -ef|grep redis
cat /proc/pid/limits

#supervisor

[supervisord]   
minfds=20480    
minprocs=20480  

#nginx

worker_rlimit_nofile 20480;
events {
    worker_connections 20480;
}