From: | Greg Smith <greg(at)2ndQuadrant(dot)com> |
---|---|
To: | Kirill Kuznetsov <kir(at)evilmartians(dot)com> |
Cc: | pgsql-pkg-debian(at)postgresql(dot)org |
Subject: | Re: "ulimit -n" in postgresql/pgbouncer init scripts. |
Date: | 2012-12-26 17:24:23 |
Message-ID: | 50DB32C7.50608@2ndQuadrant.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-pkg-debian |
On 12/26/12 6:43 AM, Kirill Kuznetsov wrote:
> But we actually need to set open files limit (ulimit -n) for these
> processes. In our packages we modified init.d script so that it
> invokes "ulimit -n" command.
> ULIMIT=1024
> ulimit -n $ULIMIT
> Is it possible for something like this to appear in PGDG packages or
> are we doing it wrong?
That would be B) doing it wrong. Packages aren't the right place to be
touching ulimit values. On Debian there are other ways to approach this
problem. One way is that you can:
-Add lines to /etc/security/limits.conf (or its include files, see [1])
to increase the values for the user like this:
postgres hard nofile 1024
postgres soft nofile 1024
Modify with the user names you want to change. * changes all users
*except* for the superuser, so that might not impact how you're running
things.
[1] You can create a file in /etc/security/limits.d/ instead with these
changes. That might be a cleaner way to manage things in your
environment. It's a good idea to check if any limit changes are
happening in that directory too, they can override yours if read in the
wrong order.
-Edit either /etc/pam.d/su and/or /etc/pam.d/common-session and make
sure this line is there:
session required pam_limits.so
That makes the way PAM is involved in switching users references the new
user's ulimit values.
There's more information about things like checking if this works as you
expect at
http://serverfault.com/questions/397553/how-does-ulimit-come-into-effect-on-the-fly
and
http://www.cyberciti.biz/faq/linux-increase-the-maximum-number-of-open-files/
--
Greg Smith 2ndQuadrant US greg(at)2ndQuadrant(dot)com Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com
From | Date | Subject | |
---|---|---|---|
Next Message | Christoph Berg | 2012-12-28 11:56:54 | Re: "ulimit -n" in postgresql/pgbouncer init scripts. |
Previous Message | Kirill Kuznetsov | 2012-12-26 11:43:11 | "ulimit -n" in postgresql/pgbouncer init scripts. |