Thursday, February 22, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  4] [ 0]  / answers: 1 / hits: 22905  / 1 Year ago, sat, november 19, 2022, 4:11:03

Shmmax, Shmall, I just can't win ;)

I've tried changing around my /etc/sysctl.d/30-postgresql-shm.conf file a fair bit uncommenting and changing the kernel.shmmax and kernel.shmall a bit but it didn't seem to help.

# Shared memory settings for PostgreSQL

# Note that if another program uses shared memory as well, you will have to
# coordinate the size settings between the two.

# Maximum size of shared memory segment in bytes
#kernel.shmmax = 33554432 # Original
#kernel.shmmax = 41943040 # Tried this (bigger)
kernel.shmmax = 943040 # and this (smaller)

# Maximum total size of shared memory in pages (normally 4096 bytes)
#kernel.shmall = 2097152 # Tried with and without this commented out

Then (the error):

$ sudo /etc/init.d/postgresql start
* Starting PostgreSQL 9.2 database server
* The PostgreSQL server failed to start. Please check the log output:
2013-04-27 16:21:33 EDT FATAL: could not create shared memory segment: Invalid argument
2013-04-27 16:21:33 EDT DETAIL: Failed system call was shmget(key=5432001, size=30490624, 03600).
2013-04-27 16:21:33 EDT 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 30490624 bytes), reduce PostgreSQL's shared memory usage,
perhaps by reducing shared_buffers or max_connections.
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.

Note: How would I 'raise the request size' as that is the only thing I haven't tried that was listed.

More From » postgresql


Well after experimenting a fair bit I found changing /etc/sysctl.conf to have kernel.shmmax=89934592 (two digits shorter than the original kernel.shmmax=8589934592) just for kicks... worked!

* Starting PostgreSQL 9.2 database server [ OK ] durrantm$

[#31543] Saturday, November 19, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 197
Total Questions: 115
Total Answers: 92

Location: Mauritania
Member since Sun, May 7, 2023
10 Months ago