Fix postgres deployment locked on postmaster.pid file

Hi all, sometimes and for unknown reason the db deployment of postgres fails to restart due to the postmaster.pid file locked.
We found a bad but working solution described above.

Error: pg_ctl: the PID file "/var/lib/pgsql/data/userdata/postmaster.pid" is empty

  1. Debug the DB pod in terminal
  2. rm /var/lib/pgsql/data/userdata/postmaster.pid

Error: pg_ctl: could not open PID file "/var/lib/pgsql/data/userdata/postmaster.pid": Transport endpoint is not connected

  1. Debug the DB pod in terminal
  2. cd /var/lib/pgsql/data
  3. cp -rav userdata userdata_new
  4. mv userdata userdata_old
  5. mv userdata_new userdata
1 Like