作者
digoal
日期
2018-01-10
标签
PostgreSQL , docker , shm , 动态共享内存
背景
如果你使用docker启动PG时,遇到类似这样的问题,可能你需要看看docker的/dev/shm是不是不够大。
"ERROR: could not resize shared memory segment "/PostgreSQL.388782411" to 50438144 bytes: No space left on device SQL state: 53100"
调整docker启动参数--shm-size
```
Thank you Thomas,
I make it work with extra setting --shm-size=1g in my docker run script.
It works with 'none' and 'sysv'--I think the issue is that technically our
environment does support 'posix', but '/dev/shm' is indeed not mounted in
the LXC container, leading to a discrepancy between what initdb decides and
what's actually possible. Thanks for your help.
Thanks,
Maciek
```
相关PostgreSQL代码
src/backend/storage/ipc/dsm_impl.c
相关Docker参数
``` --ipc="MODE" : Set the IPC mode for the container
Value Description ”” Use daemon’s default. “none” Own private IPC namespace, with /dev/shm not mounted. “private” Own private IPC namespace. “shareable” Own private IPC namespace, with a possibility to share it with other containers. “container: <name-or-ID>" Join another (“shareable”) container’s IPC namespace. “host” Use the host system’s IPC namespace.
--shm-size=""
Size of /dev/shm.
The format is
参考
https://www.postgresql.org/message-id/flat/20140612090731.GB6907%40msgid.df7cb.de#20140612090731.GB6907@msgid.df7cb.de
http://www.postgresql-archive.org/Fwd-Query-error-could-not-resize-shared-memory-segment-td5998965.html#a5999004
https://docs.docker.com/engine/reference/run/
PostgreSQL 许愿链接
您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.
9.9元购买3个月阿里云RDS PostgreSQL实例
PostgreSQL 解决方案集合
德哥 / digoal's github - 公益是一辈子的事.





