Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TnuiU-00030w-3O for pgsql-pkg-debian@arkaria.postgresql.org; Wed, 26 Dec 2012 17:24:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1TnuiS-0003cR-E0 for pgsql-pkg-debian@arkaria.postgresql.org; Wed, 26 Dec 2012 17:24:28 +0000 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TnuiR-0003cK-L8 for pgsql-pkg-debian@postgresql.org; Wed, 26 Dec 2012 17:24:27 +0000 Received: from moutng.kundenserver.de ([212.227.126.187]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1TnuiM-0003X7-TG for pgsql-pkg-debian@postgresql.org; Wed, 26 Dec 2012 17:24:26 +0000 Received: from [192.168.2.110] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu4) with ESMTP (Nemesis) id 0Mctwz-1TW6qb3fZx-00HyFl; Wed, 26 Dec 2012 18:24:21 +0100 Message-ID: <50DB32C7.50608@2ndQuadrant.com> Date: Wed, 26 Dec 2012 12:24:23 -0500 From: Greg Smith User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Kirill Kuznetsov CC: pgsql-pkg-debian@postgresql.org Subject: Re: "ulimit -n" in postgresql/pgbouncer init scripts. References: In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:rFTiBDA6kDVsL1VoNaUFqhJa0AqON74Wlrxy6Isq6Jf cFE/NCntOvLfi1mMv/j0e/9neER4x+sWyzg9YG1DDyw21szcr5 Tqw8YoQxhvFgZuUXXkE8yqjP9AJpipT23kFHj+yvKEYT68skrL fzYeKBt5IjzOzyO3KcAABRiMGFCGlhCFqzOGJQ9Pfo6Ug0CLOn ey+TVlXYMFWRXliYxMtIGbhwj7tDeLbF8jK7hmd9gxKhW10Evj oxHNSAoEiRPq1qPtq0QfKt5wdS9BQ4w4BEY8qUEzo8nu1uj097 x90ptchXYTg2sGqHzQTGI8FyrBnC/JyMXjpwNfD5apJbo/NVlt a+Yrd18OWvWSDanssaks= X-Pg-Spam-Score: -1.9 (-) X-Mailing-List: pgsql-pkg-debian List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Precedence: bulk Sender: pgsql-pkg-debian-owner@postgresql.org 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 -- Sent via pgsql-pkg-debian mailing list (pgsql-pkg-debian@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-pkg-debian