0

Postgres was running just fine (I have created a database using template0). Then, I used:

$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data stop --mode=smart

to stop Postgres and it stopped without a fuss. Then, I used:

$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l /var/log/postgres/serverlog start
server starting

and it appeared to start without a fuss... but then:

$ /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data status                              
pg_ctl: no server running

Just to be sure, a ps aux | grep postgres returns nothing.

Why would this happen?

Note: I'm logged in as postgres and /usr/local/pgsql/data dir is recursively owned by postgres, but worth noting is that the postgres is using /etc/sh vs /etc/bash since I was stupid and used useradd vs adduser. I'm on Ubuntu 12.04.2 and running Postgres 9.2.4.

orokusaki
  • 2,763
  • 4
  • 32
  • 43
  • 2
    Did you check the Postgres server logs? – Joel E Salas May 31 '13 at 05:02
  • Ah :( `This error usually means that PostgreSQL's request for a shared memory segment exceeded your kernel's SHMMAX parameter`... – orokusaki May 31 '13 at 05:06
  • I have 2GB of RAM. Any idea what my shmmax should be set to? http://www.postgresql.org/docs/9.2/static/kernel-resources.html gives some examples, but I'm not sure if I'm supposed to make the 4096 * max pages == my total RAM... – orokusaki May 31 '13 at 05:23
  • Which OS is this? Postgres 9.1 ran out of the box on my CentOS VPS with 512MB RAM... – Joel E Salas Jun 01 '13 at 19:05
  • @JoelESalas - I had configured `shared_buffers` to `256MB` - `shmmax` was something smaller by default. I updated it to `384MB` in `/etc/sysctl.conf` to get Postgres working again (the actual segment size requested was something like `277MB`). – orokusaki Jun 01 '13 at 19:10

1 Answers1

2

When a service dies immediately after launching with no warning, you'll have to refer to the service logs to see what's going on. Generally it's a fairly egregious crash.

Check the Postgres server logs to see what, if anything, the service is logging before it dies.

Joel E Salas
  • 5,572
  • 16
  • 25