[CentOS] CentOS 6: Increase shared memory limits permanently

Tue Oct 4 15:45:52 UTC 2011
Alexander Farber <alexander.farber at gmail.com>

Hello again,

on CentOS 6 / 64 bit what is please the best way
to permanently increase the shared memory?

I'd like to give shared_buffers = 4096MB
to PostgreSQL 8.4 on my machine with
16 GB RAM, but I currently only have:

   # sysctl -A|grep shm
   kernel.shmmax = 33554432
   kernel.shmall = 2097152
   kernel.shmmni = 4096

and this produces the error in
 /var/lib/pgsql/pgstartup.log:

FATAL:  could not create shared memory segment: Invalid argument
DETAIL:  Failed system call was shmget(key=5432001, size=4399202304, 03600).
HINT:  This error usually means that PostgreSQL's request for a shared
memory segment exceeded your kernel's SHMMAX parameter.  You can
either reduce the request size or reconfigure the kernel with larger
SHMMAX.  To reduce the request size (currently 4399202304 bytes),
reduce PostgreSQL's shared_buffers parameter (currently 524288) and/or
its max_connections parameter (currently 103).
        If the request size is already small, it's possible that it is
less than your kernel's SHMMIN parameter, in which case raising the
request size or reconfiguring SHMMIN is called for.
        The PostgreSQL documentation contains more information about
shared memory configuration.

And I wonder if I should set shmmax
or shmall and also if these 2 limits
are total for all machine processes
or per process? (i.e. should I allow
a bit more for processes besides PostgreSQL)?

Thank you
Alex