报错Too many open files

embedded/2025/2/6 0:46:59/

1、先查看系统最大打开文件数

# 查看当前系统打开文件最大数
# ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 256946
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1000000               # 这里
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 256946
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

2、修改系统最大文件描述符(重新登录生效)

# cat /etc/security/limits.conf |tail -5
# End of file
<domain>      <type>  <item>         <value>
*             soft   nofile          204800
*             hard   nofile          204800# 理解生效
ulimit -SHn 294800# 再次查看
ulimit -a  或 ulimit -n

3、查看系统总限制大小

# cat /proc/sys/fs/file-max
6305734

4、修改nginx打开文件数据限制大小

# cat /etc/nginx/nginx.conf |head -10user  nginx;
worker_processes  auto;error_log  /var/log/nginx/error.log notice;
pid        /var/run/nginx.pid;
worker_rlimit_nofile 20480;         # 这里

5、nginx stream配置

http {
......
......
.....
}stream {log_format proxy '$remote_addr [$time_local]''$protocol $status $bytes_sent $bytes_received ''$session_time "$upstream_addr" ''"$upstream_bytes_sent" "$upstream_bytes_received" "$upstream_connect_time"';error_log  /var/log/nginx/udp-error.log    error;access_log /var/log/nginx/udp-access.log proxy ;server{preread_buffer_size 0;listen 30000-30150 udp;    # 后面不要加 reuseport否则会报错listen 31000-31100 udp;listen 32000-32100 udp;  # proxy_pass 139.217.184.100:$server_port;proxy_pass 52.131.225.53:$server_port;   # 这里指向网关地址(网关如果是k8s就写k8s slbip或容器地址就写容器ip)}}

http://www.ppmy.cn/embedded/159887.html

相关文章

Qt 5.14.2 学习记录 —— 이십삼 绘图API

文章目录 1、概念2、API 1、概念 Qt的各个控件本质是画出来的。有时候现有控件无法完成所需功能&#xff0c;那就用绘图API来自定义控件。 QPainter提供一系列的绘图方法 QPaintDevice表示用户画的要放到哪个设备上&#xff0c;QWidget是它的子列 QPen是画笔 QBrush是画刷&…

llama.cpp LLM_CHAT_TEMPLATE_DEEPSEEK_3

llama.cpp LLM_CHAT_TEMPLATE_DEEPSEEK_3 1. LLAMA_VOCAB_PRE_TYPE_DEEPSEEK3_LLM2. static const std::map<std::string, llm_chat_template> LLM_CHAT_TEMPLATES3. LLM_CHAT_TEMPLATE_DEEPSEEK_3References 不宜吹捧中国大语言模型的同时&#xff0c;又去贬低美国大语言…

CTFSHOW-WEB入门-命令执行71-77

题目&#xff1a;web 71 题目&#xff1a;解题思路&#xff1a;分析可知highlight_file() 函数被禁了&#xff0c;先想办法看看根目录&#xff1a;cvar_export(scandir(dirname(‘/’))); 尝试一下发现很惊奇&#xff1a;&#xff08;全是&#xff1f;&#xff09;这种情况我也…

新站如何快速获得搜索引擎收录?

本文来自&#xff1a;百万收录网 原文链接&#xff1a;https://www.baiwanshoulu.com/8.html 新站想要快速获得搜索引擎收录&#xff0c;需要采取一系列有针对性的策略。以下是一些具体的建议&#xff1a; 一、网站内容优化 高质量原创内容&#xff1a; 确保网站内容原创、…

C++滑动窗口技术深度解析:核心原理、高效实现与高阶应用实践

目录 一、滑动窗口的核心原理 二、滑动窗口的两种类型 1. 固定大小的窗口 2. 可变大小的窗口 三、实现细节与关键点 1. 窗口的初始化 2. 窗口的移动策略 3. 结果的更新时机 四、经典问题与代码示例 示例 1&#xff1a;和 ≥ target 的最短子数组&#xff08;可变窗口…

【IoCDI】_方法注解@Bean

目录 1. 类注解的使用局限 2. 仅使用Bean注解 3. 五大注解配合使用Bean 3.1 使用方式1&#xff1a;getBean传参Bean类型 3.2 使用方式2&#xff1a;getBean传参Bean名称 3.3 使用方式3&#xff1a;getBean传参Bean名称类型 在上文中&#xff0c;已经介绍了五大类注解及ge…

SQL入门到精通 理论+实战 -- 在 MySQL 中学习SQL语言

目录 一、环境准备 1、MySQL 8.0 和 Navicat 下载安装 2、准备好的表和数据文件&#xff1a; 二、SQL语言简述 1、数据库基础概念 2、什么是SQL 3、SQL的分类 4、SQL通用语法 三、DDL&#xff08;Data Definition Language&#xff09;&#xff1a;数据定义语言 1、操…

64位的谷歌浏览器Chrome/Google Chrome

64位的谷歌浏览器Chrome/Google Chrome 在百度搜索关键字:chrome&#xff0c;即可下载官方的“谷歌浏览器Chrome/Google Chrome”&#xff0c;但它可能是32位的&#xff08;切记注意网址&#xff1a;https://www.google.cn/....&#xff0c; 即&#xff1a;google.cn&#xff…