Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 2A8F9358049 for ; Sat, 28 Apr 2012 13:38:19 -0300 (ADT) Received: from 74-93-229-125-colorado.hfc.comcastbusiness.net ([74.93.229.125] helo=mail.consistentstate.com) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1SOAf4-0001rv-4Y for pgsql-admin@postgresql.org; Sat, 28 Apr 2012 16:38:18 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.consistentstate.com (Postfix) with ESMTP id 884443063D9; Sat, 28 Apr 2012 10:38:05 -0600 (MDT) X-Virus-Scanned: amavisd-new at consistentstate.com Received: from mail.consistentstate.com ([127.0.0.1]) by localhost (mail.consistentstate.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id R0cSj75RxmOV; Sat, 28 Apr 2012 10:37:59 -0600 (MDT) Received: from Issac.consistentstate.com (unknown [67.137.237.194]) by mail.consistentstate.com (Postfix) with ESMTPSA id 0B9C53063CC; Sat, 28 Apr 2012 10:37:58 -0600 (MDT) Message-ID: <4F9C1CE6.20803@consistentstate.com> Date: Sat, 28 Apr 2012 10:37:58 -0600 From: Kevin Kempter User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:11.0) Gecko/20120329 Thunderbird/11.0.1 MIME-Version: 1.0 To: Fernando Hevia CC: pgsql-admin@postgresql.org Subject: Re: Postgres shared memory error References: <4F9C1659.5070503@consistentstate.com> In-Reply-To: Content-Type: multipart/alternative; boundary="------------060500090602070107030707" X-Pg-Spam-Score: -0.9 (/) X-Archive-Number: 201204/149 X-Sequence-Number: 39485 This is a multi-part message in MIME format. --------------060500090602070107030707 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 04/28/2012 10:32 AM, Fernando Hevia wrote: > > > On Sat, Apr 28, 2012 at 13:10, Kevin Kempter > > wrote: > > All; > > I just want to be sure that I'm not causing myself greif. I have > a kvm in the cloud that is supposed to have access to 32GB of ram. > when I do a top I only see 1GB of ram, I've pinged the hosting > provider, maybe it shows up as it's used? > > > What does the 'free' command show? > > Anyway when I try and start postgres I see this: > / > $ 2012-04-28 12:00:33 EDT [6429]: [1-1] FATAL: XX000: could not > create shared memory segment: Cannot allocate memory > 2012-04-28 12:00:33 EDT [6429]: [2-1] DETAIL: Failed system call > was shmget(key=5432001, size=7700914176, 03600). > 2012-04-28 12:00:33 EDT [6429]: [3-1] HINT: This error usually > means that PostgreSQL's request for a shared memory segment > exceeded available memory or swap space. To reduce the request > size (currently 7700914176 bytes), reduce PostgreSQL's > shared_buffers parameter (currently 917504) and/or its > max_connections parameter (currently 503). > The PostgreSQL documentation contains more information > about shared memory configuration. > 2012-04-28 12:00:33 EDT [6429]: [4-1] LOCATION: > InternalIpcMemoryCreate, pg_shmem.c:178 / > > > Which means I should bump up shmmax like this: > > /# sysctl -w kernel.shmmax=7700914176/ > > > and add it to /etc/sysctl.conf: > > /# tail /etc/sysctl.conf > kernel.msgmax = 65536 > > # Controls the maximum shared segment size, in bytes > kernel.shmmax = 68719476736 > > # Controls the maximum number of shared memory segments, in pages > kernel.shmall = 4294967296 > > #PostgreSQL > kernel.shmmax = 7700914176 / > > > I assume I should have to tweak ONLY kernel.shmmax, am I correct? > > > Correct. > > I'm also assuming that this is a KVM cloud host provider issue, > i.e. it looks like I actually do not have 32G or ram. Does anyone > disagree with my conclusions? > > > You haven't provided evidence on how much RAM your system sees. A free > -m will show the total memory the system has and is being used. > Regards. Free command: / # free total used free shared buffers cached Mem: 1020856 946804 74052 0 61280 796004 -/+ buffers/cache: 89520 931336 Swap: 0 0 0/ --------------060500090602070107030707 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit On 04/28/2012 10:32 AM, Fernando Hevia wrote:


On Sat, Apr 28, 2012 at 13:10, Kevin Kempter <cs_dba@consistentstate.com> wrote:
All;

I just want to be sure that I'm not causing myself greif.  I have a kvm in the cloud that is supposed to have access to 32GB of ram. when I do a top I only see 1GB of ram, I've pinged the hosting provider, maybe it shows up as it's used?


What does the 'free' command show?

 
Anyway when I try and start postgres I see this:

 $ 2012-04-28 12:00:33 EDT [6429]: [1-1] FATAL:  XX000: could not create shared memory segment: Cannot allocate memory                    
2012-04-28 12:00:33 EDT [6429]: [2-1] DETAIL:  Failed system call was shmget(key=5432001, size=7700914176, 03600).                                             
2012-04-28 12:00:33 EDT [6429]: [3-1] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory or swap space. To reduce the request size (currently 7700914176 bytes), reduce PostgreSQL's shared_buffers parameter (currently 917504) and/or its max_connections parameter (currently 503).                                                            
        The PostgreSQL documentation contains more information about shared memory configuration.                                                              
2012-04-28 12:00:33 EDT [6429]: [4-1] LOCATION:  InternalIpcMemoryCreate, pg_shmem.c:178 



Which means I should bump up shmmax like this:

# sysctl -w kernel.shmmax=7700914176


and add it to /etc/sysctl.conf:

# tail /etc/sysctl.conf                                                          
kernel.msgmax = 65536                                                                              
                                                                                                   
# Controls the maximum shared segment size, in bytes                                               
kernel.shmmax = 68719476736                                                                        
                                                                                                   
# Controls the maximum number of shared memory segments, in pages                                  
kernel.shmall = 4294967296                                                                         
                                                                                                   
#PostgreSQL                                                                                        
kernel.shmmax = 7700914176 



I assume I should have to tweak ONLY kernel.shmmax, am I correct?

Correct.
 
I'm also assuming that this is a KVM cloud host provider issue, i.e. it looks like I actually do not have 32G or ram.  Does anyone disagree with my conclusions?


You haven't provided evidence on how much RAM your system sees. A free -m will show the total memory the system has and is being used. 
 
Regards.



Free command:

 # free
             total       used       free     shared    buffers     cached
Mem:       1020856     946804      74052          0      61280     796004
-/+ buffers/cache:      89520     931336
Swap:            0          0          0






--------------060500090602070107030707--