shared_buffers = 512MBThen I tried to restart PostgreSQL, and it flopped.
$ service postgresql startLooking in /var/log/messages I see:
redirecting to systemctl
Job failed. See system logs and 'systemctl status' for details.
Dec 9 19:27:23 workstation postgresql[7288]: Starting PostgreSQL2011-12-09 19:27:23 EST FATAL: could not create shared memory segment: Invalid argumentHuh. I remember an error message like that from the RedHat 6.x & 7.x days when the kernel's default settings regarding System V IPC resources where really low. Back then you possibly had to go look at defines in header files for these values. Fortunately we now have sysctl. And what does sysctl tell us?
Dec 9 19:27:23 workstation postgresql[7288]: 2011-12-09 19:27:23 EST DETAIL: Failed system call was shmget(key=5432001, size=76685312, 03600).
$ sysctl kernel.shmmaxWhat?!?! That value is in bytes - so the limit is ~32MB?! This is on a 64-bit installation with 8GB of RAM. That makes no sense at all. Time to change that to something reasonable:
kernel.shmmax = 33554432
$ sysctl -w kernel.shmmax=1000000000And now "service postgresql start" succeeds. The ipcs command which reports System V IPC resources allocated in the system shows that the PostgreSQL engine has allocated the expected buffer pool:
$ ipcs
------ Shared Memory Segments --------
key shmid owner perms bytes nattch status
0x0052e2c1 1212416 postgres 600 572383232 4 Once you change a sysctl setting in a helpful way the change has to be added to the /etc/sysctl.d/ so that it gets re-applied when the machine reboots; otherwise our PostgreSQL instance is going to fail to start next time. Create a file in that directory with a name such as postgresql.conf containing a single line of -kernel.shmmax = 1000000000The files in /etc/sysctl.d/ are processed after distribution and package defaults are applied. It is also possible to edit /etc/sysctl.conf; however manual changes to that file may get overwritten by system management tools. So use the /etc/sysctl.d/ strategy to override distribution defaults.
Now, back to work.
0 comments:
Post a Comment