【问题标题】:postgresql shared memory settingspostgresql 共享内存设置
【发布时间】:2012-09-18 23:26:16
【问题描述】:

大家好!

我们目前有以下与共享内存相关的参数:

postgres

shared_buffers = 7GB
max_connections = 1 500
max_locks_per_transaction = 1 024
max_prepared_transactions = 0 (not set)

系统

SHMALL = 2 097 152
SHMMAX = 17 670 512 640
SHMMNI = 4096

RAM 数量为 24 693 176k

我们需要将 max_connections 增加到 3 000。当我们尝试这样做时,出现错误

[1-1] FATAL:  could not create shared memory segment: No space left on device
[2-1] DETAIL:  Failed system call was shmget(key=5432001, size=8964661248, 03600)
[3-1] HINT:  This error does *not* mean that you have run out of disk space.
It occurs either if all available shared memory IDs have been taken, in which
case you need to raise the SHMMNI parameter in your kernel, or because the
system's overall limit for shared memory has been reached.  If you cannot
increase the shared memory limit, reduce PostgreSQL's shared memory request
(currently 8964661248 bytes), perhaps by reducing shared_buffers or
max_connections.
The PostgreSQL documentation contains more information about shared memory
configuration.

提示建议增加 SHMMNI 内核参数,但我不确定要添加多少 :) 另外,我相信所有这些参数都以某种方式相关,所以我们需要更改任何参数吗?相应的其他参数?

提前致谢,

亚历山大

【问题讨论】:

    标签: postgresql shared-memory


    【解决方案1】:

    增加SHMMNI 将无济于事,这里重要的是提示的第二部分。

    使用 shell 命令 getconf PAGE_SIZE 获取系统的页面大小。
    通常是 4096。乘以 SHMALL

    在您的情况下,应该是 2097152 * 4096 = 8589934592,正好是 8Gb。 这是您当前的最大共享内存,独立于SHMMNI

    PostgreSQL 错误消息表明它需要更多。

    结论:增加SHMALL

    【讨论】:

    • 注意:根据文档中的 linux 部分 (postgresql.org/docs/9.0/static/kernel-resources.html),SHMALL 的值应该是 PAGE_SIZE 除以 SHMAX。跨度>
    猜你喜欢
    • 2011-03-09
    • 1970-01-01
    • 1970-01-01
    • 2014-10-08
    • 2021-06-15
    • 1970-01-01
    • 2012-02-04
    相关资源
    最近更新 更多