CentOS 修改进程相关配置文件的位置与方法
一、服务单元文件的位置与优先级
二、修改某个服务进程的配置
sudo systemctl edit <服务名>,例如 sudo systemctl edit nginx.servicedaemon-reload,只需重启服务即可生效。[Service]
LimitNOFILE=65535
LimitNPROC=65535
sudo cp /usr/lib/systemd/system/<服务名>.service /etc/systemd/system/<服务名>.servicesudo systemctl daemon-reload && sudo systemctl restart <服务名>systemctl cat <服务名>cat /proc/<PID>/limitssudo systemctl revert <服务名>。三、调整系统级进程与文件句柄限制
DefaultLimitNOFILE=65535DefaultLimitNPROC=65535DefaultLimitCORE=infinity* soft nofile 65535
* hard nofile 65535
* soft nproc 65535
* hard nproc 65535
ulimit -n(文件句柄)、ulimit -u(进程数)cat /proc/<PID>/limits。四、快速排查与常用命令
systemctl cat <服务名>sudo systemctl daemon-reload && sudo systemctl restart <服务名>systemctl status <服务名>、journalctl -u <服务名> -xecat /proc/<PID>/limitssystemctl list-units、systemctl list-unit-files。