Postgresql启动失败之 could not map anonymous shared memory: Cannot allocate memory

博客内容讲述了在启动PostgreSQL数据库时遇到'FATAL: could not map anonymous shared memory'错误的原因和解决方案。问题源于PostgreSQL请求的共享内存超过了系统可用内存。建议检查并调整配置文件postgresql.conf中的shared_buffers参数,降低其大小以适应系统资源。同时,考虑减少max_connections等占用内存的设置。

现象

启动报错

waiting for server to start....2022-03-11 16:52:05.485 CST [56148] LOG:  starting PostgreSQL 12.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4), 64-bit
2022-03-11 16:52:05.485 CST [56148] LOG:  listening on IPv4 address "0.0.0.0", port 5432
2022-03-11 16:52:05.485 CST [56148] LOG:  listening on IPv6 address "::", port 5432
2022-03-11 16:52:05.487 CST [56148] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2022-03-11 16:52:05.488 CST [56148] FATAL:  could not map anonymous shared memory: Cannot allocate memory
2022-03-11 16:52:05.488 CST [56148] HINT:  This error usually means that PostgreSQL's request for a shared memory segment exceeded available memory, swap space, or huge pages. To reduce the request size (currently 34628599808 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
2022-03-11 16:52:05.488 CST [56148] LOG:  database system is shut down
 stopped waiting
pg_ctl: could not start server
Examine the log output.

主要报错:FATAL:  could not map anonymous shared memory: Cannot allocate memory

字面意思内存不够用于分配shared memory大小,即shared memory设置超出了所能分配到的内存大小

查看内存

 查看配置

查看路径:locate postgresql.conf

配置参考路径:data/postgresql.conf

 

原来设置的推荐shared_buffers为总内存的25%,但是由于后续该机器装了其他程序,导致内存吃紧,所以只有降低大小,才能满足启动需求

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值