This post explains how to change the ulimit limits such as the maximum open files for a systemd service. In a CentOS/RHEL 7 or 8 system, the changes done in /etc/security/limits.conf or /etc/security/limits.d/ have no effect on systemd services.
Systemd deliberately ignores the system-wide ulimit settings in order to minimize unintentional or unexpected limit changes caused by shell profiles and scripts.
You can set a new maximum open files limit for a particular service, for example, like this:
1. Identify the name.service file you want in /usr/lib/systemd/system.
2. Copy that file to the /etc/systemd/system directory.
3. Edit the copied file in /etc/systemd/system and add the line:
4. Restart the service:
# systemctl restart [service name]
Update the ulimit values globally for all systemd services
Alternatively, you can update the same limit for ALL systemd services like this:
1. Edit /etc/systemd/system.conf and uncomment the “#DefaultLimitNOFILE=” line, appending the desired number.
2. Reboot the system:
# systemctl reboot