Question

Postgres not able to start

I have a problem with postgres not being able to start:

  • Starting PostgreSQL 9.5 database server * The PostgreSQL server failed to start. Please check the log output: 2016-08-25 04:20:53 EDT [1763-1] FATAL: could not map anonymous shared memory: Cannot allocate memory 2016-08-25 04:20:53 EDT [1763-2] 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 1124007936 bytes), reduce PostgreSQL’s shared memory usage, perhaps by reducing shared_buffers or max_connections. This is the response that I got. I checked the log in tail -f /var/log/postgresql/postgresql-9.5-main.logand I can see the same response.

Can someone suggest what can be the problem?

I used following commands to stop/start the postgres server on Ubuntu 14.04 with postgres 9.5:

sudo service postgresql stop sudo service postgresql start


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Accepted Answer

As the error message indicates, you appear to not have enough available memory to start the service. You can check your available memory at any time by running the command:

free -m

When you see this error, aside from the suggestions for optimizations presented by the error message you can also add a swap file and/or upgrade to a larger droplet in order to have more memory+swap available for the PostgreSQL process.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.