Skip to content

Instantly share code, notes, and snippets.

@Phrogz
Created April 30, 2010 05:02
Show Gist options
  • Save Phrogz/384774 to your computer and use it in GitHub Desktop.
Save Phrogz/384774 to your computer and use it in GitHub Desktop.
Slim2:pgsql _postgres$ sysctl -a | grep shm
kern.sysv.shmmax: 2147483648
kern.sysv.shmmin: 1
kern.sysv.shmmni: 32
kern.sysv.shmseg: 8
kern.sysv.shmall: 2147483648
machdep.pmap.hashmax: 12
security.mac.posixshm_enforce: 1
security.mac.sysvshm_enforce: 1
Slim2:pgsql _postgres$ cat data/postgresql.conf | grep -E "max_conn|shared_buff"
max_connections = 10 # (change requires restart)
# Note: Increasing max_connections costs ~400 bytes of shared memory per
shared_buffers = 16MB # min 128kB
# max_locks_per_transaction * (max_connections + max_prepared_transactions)
Slim2:pgsql _postgres$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data start
server starting
Slim2:pgsql _postgres$ FATAL: could not create shared memory segment: Invalid argument
DETAIL: Failed system call was shmget(key=5432001, size=18366464, 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 18366464 bytes), reduce PostgreSQL's shared_buffers parameter (currently 2048) and/or its max_connections parameter (currently 13).
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment