在16GB的Linode VPS上调整Postgresql

我在一个16GB的Linode(Ubuntu 12.04 32bit)上运行一个专用的PostgreSQL。 我试过使用pgtune,但我会遇到共享内存错误。 即

The PostgreSQL server failed to start. Please check the log output: 2014-02-10 08:32:39 EST FATAL: could not create shared memory segment: Invalid argument 2014-02-10 08:32:39 EST DETAIL: Failed system call was shmget(key=5432001, size=4107419648, 03600). 2014-02-10 08:32:39 EST 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 4107419648 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 

所以我继续开始调整SHMAX,但我真的不知道我应该设置什么。 我希望pgtune会让我知道,或者我可以find一些关于这个@ linode的文档。 我假设这个值是以字节为单位的? 我读过的内容应该是内存总容量的1/4到1/2(比如4或8 GB),而且在32位时不应该超过4GB。

有什么build议? 你会推荐什么设置SHMAX,为什么? 我应该放弃pgtune,还是传递最大内存参数?

谢谢!

VPS内存细节:

  total used free shared buffers cached Mem: 16617352 334320 16283032 0 18132 208400 -/+ buffers/cache: 107788 16509564 Swap: 524284 0 524284 

– 更新 –

迁移到64位基本上使一切工作。 SHMAX正在被接受(顺便说一句,这是字节)。 确定要设置的内容我刚刚使用了一半的可用内存(Ubuntu上的“free -b”以字节方式查看内存)。

我基本上与其他pgtunebuild议去了一些小的调整。

 apt-get install pgtune 

您在具有16GB内存的计算机上安装了32位操作系统。 这是不行的。 即使32位操作系统在技术上可以使用超过4GB的RAM,操作系统上的任何一个进程都不能超过这个界限。 重新开始并安装一个64位操作系统,这个问题就会消失(以及所有其他的问题)。