{"id":231,"date":"2016-01-15T02:14:28","date_gmt":"2016-01-15T06:14:28","guid":{"rendered":"https:\/\/www.grumpyland.com\/blog\/?p=231"},"modified":"2016-01-28T18:31:11","modified_gmt":"2016-01-28T22:31:11","slug":"changing-limits-for-services-with-centos-7-rhel-7-systemd","status":"publish","type":"post","link":"https:\/\/www.grumpyland.com\/blog\/231\/changing-limits-for-services-with-centos-7-rhel-7-systemd\/","title":{"rendered":"Changing Limits for Services with CentOS 7 \/ RHEL 7 \/ Systemd"},"content":{"rendered":"<p>Hitting too many open file limit for apache? In the previous OS versions, changing limits like open file number would be set in<\/p>\n<pre>\/etc\/security\/limits.conf<\/pre>\n<p>or directly inside the start up script. In some ways the new method brings better organization to the limits, but its change is very confusing to people who were expecting the same. I myself was befuddled with the open file limit with the web server saying &#8220;Too many open files&#8221; and despite changing limits in the old way (which still exists), it just wasn&#8217;t solving it.<\/p>\n<p>The limits are set according to specification set here:<\/p>\n<pre>\/usr\/lib\/systemd\/system\/[name of service].service\r\n\/usr\/lib\/systemd\/system\/httpd.service   \/\/ apache example\r\n\/usr\/lib\/systemd\/system\/mariadb.service   \/\/ mariadb example\r\n<\/pre>\n<p>But it&#8217;s not recommended that you edit that. It&#8217;s because that&#8217;ll be over written with package update. What you should edit is:<\/p>\n<pre>\/etc\/systemd\/system\/[name of service].service.d\/limits.conf<\/pre>\n<p>Often the folder for it won&#8217;t exist either. So you&#8217;ll have to make the folder first like (with httpd example):<\/p>\n<pre># mkdir -p\u00a0\/etc\/systemd\/system\/httpd.service.d\/<\/pre>\n<p>Now\u00a0create\/edit\/append a file so that the contents would be like below.<\/p>\n<pre># cat \/etc\/systemd\/system\/httpd.service.d\/limits.conf\r\n[Service]\r\nLimitNOFILE=20000<\/pre>\n<p>Now reload the system daemon so it learns of the update. This action alone doesn&#8217;t not restart any service.<\/p>\n<pre># systemctl daemon-reload<\/pre>\n<p>And also restart the service itself.<\/p>\n<pre>#\u00a0systemctl restart\u00a0httpd<\/pre>\n<p>That&#8217;s it!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hitting too many open file limit for apache? In the previous OS versions, changing limits like open file number would be set in \/etc\/security\/limits.conf or directly inside the start up script. In some ways the new method brings better organization to the limits, but its change is very confusing to people who were expecting the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_vp_format_video_url":"","_vp_image_focal_point":[],"footnotes":""},"categories":[15],"tags":[37,42,40,41],"class_list":["post-231","post","type-post","status-publish","format-standard","hentry","category-tutorial","tag-centos-7","tag-limits-conf","tag-rhel-7","tag-systemd"],"_links":{"self":[{"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/posts\/231","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/comments?post=231"}],"version-history":[{"count":5,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/posts\/231\/revisions"}],"predecessor-version":[{"id":236,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/posts\/231\/revisions\/236"}],"wp:attachment":[{"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/media?parent=231"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/categories?post=231"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.grumpyland.com\/blog\/wp-json\/wp\/v2\/tags?post=231"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}