Re: "ulimit -n" in postgresql/pgbouncer init scripts.

Поиск
Список
Период
Сортировка
Искать
От
Greg Smith
Тема
Re: "ulimit -n" in postgresql/pgbouncer init scripts.
Дата
Msg-id
50DB32C7.50608@2ndQuadrant.com
Ответ на
Список
Дерево обсуждения
"ulimit -n" in postgresql/pgbouncer init scripts. Kirill Kuznetsov <kir@evilmartians.com>
Re: "ulimit -n" in postgresql/pgbouncer init scripts. Greg Smith <greg@2ndQuadrant.com>
Re: "ulimit -n" in postgresql/pgbouncer init scripts. Christoph Berg <myon@debian.org>
Re: "ulimit -n" in postgresql/pgbouncer init scripts. Dimitri Fontaine <dimitri@2ndQuadrant.fr>
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@2ndQuadrant.com   Baltimore, MD
PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com

В списке pgsql-pkg-debian по дате отправления
От: Kirill Kuznetsov
Дата:
От: Christoph Berg
Дата:
FAQ