Ubuntu 解决 Too many open files 问题

#查看限制结果 
ulimit -a

# 修改配置
# 删除最后一行
echo -e "# add_config" | sudo tee -a /etc/security/limits.conf

# 加上文本
echo -e "\n" | sudo tee -a /etc/security/limits.conf
echo -e "mzc  \t  soft  \t  nproc  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "mzc  \t  hard  \t  nproc  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "mzc  \t  soft  \t  nofile  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "mzc  \t  hard  \t  nofile  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "root  \t  soft  \t  nproc  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "root  \t  hard  \t  nproc  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "root  \t  soft  \t  nofile  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "root  \t  hard  \t  nofile  \t  204800" | sudo tee -a /etc/security/limits.conf
echo -e "\n" | sudo tee -a /etc/security/limits.conf
echo -e "# End of file" | sudo tee -a /etc/security/limits.conf

echo -e "\n" | sudo tee -a /etc/systemd/system.conf 
echo -e "# add_config" | sudo tee -a /etc/systemd/system.conf 
echo -e "DefaultLimitNOFILE=204800" | sudo tee -a /etc/systemd/system.conf 

echo -e "\n" | sudo tee -a /etc/systemd/user.conf 
echo -e "# add_config" | sudo tee -a /etc/systemd/user.conf 
echo -e "DefaultLimitNOFILE=204800" | sudo tee -a /etc/systemd/user.conf 
posted @ 2024-05-22 22:43  meizhengchao  阅读(206)  评论(0编辑  收藏  举报