I recently realized my site was down, and after I checked the logs I noticed I couldn’t connect to postgres. Once I started postgres the site was back up.

Couple of questions:

  • What might cause postgres to stop?
  • What’s a way that I could get an alert if my site goes down?

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.

×
1 answer

Then you would need to check postgres logs to find out why it crashes.

  • Looks like it ran out of memory.

    2017-08-16 15:37:13 UTC [1614-2] LOG:  received fast shutdown request
    2017-08-16 15:37:13 UTC [1614-3] LOG:  aborting any active transactions
    2017-08-16 15:37:13 UTC [1640-2] LOG:  autovacuum launcher shutting down
    2017-08-16 15:37:13 UTC [1637-1] LOG:  shutting down
    2017-08-16 15:37:13 UTC [1637-2] LOG:  database system is shut down
    2017-08-16 15:37:15 UTC [31373-1] FATAL:  could not map anonymous shared memory: Cannot allocate memory
    2017-08-16 15:37:15 UTC [31373-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 148488192 bytes), reduce PostgreSQL's shared memory usage, perhaps by reducing shared_buffers or max_connections.
    
Submit an Answer