Postgres 10 database running on a Centos RHEL 7. This Database is a Master and it has 1 stand_by replica acting as a mirror. Well my intention was to change the wal_level in the configuration from replica to logical, so I did, I changed it in the postgresql.conf and tried to restart the service as the instructions in the postgresql.conf said.

systemctl restart postgresql-10.service didn't worked, when I execute systemctl status postgresql-10.service this is shown:

● postgresql-10.service - PostgreSQL 10 database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql-10.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since mar 2018-10-30 10:40:40 GMT; 12min ago
     Docs: https://www.postgresql.org/docs/10/static/
  Process: 19359 ExecStart=/usr/pgsql-10/bin/postmaster -D ${PGDATA} (code=exited, status=1/FAILURE)
  Process: 19353 ExecStartPre=/usr/pgsql-10/bin/postgresql-10-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)
 Main PID: 19359 (code=exited, status=1/FAILURE)

oct 30 10:40:40 server systemd[1]: Starting PostgreSQL 10 database server...
oct 30 10:40:40 server postmaster[19359]: 2018-10-30 10:40:40.431 GMT [19359] FATAL:  lock file "postmaster.pid" already exists
oct 30 10:40:40 server postmaster[19359]: 2018-10-30 10:40:40.431 GMT [19359] HINT:  Is another postmaster (PID 8545) running in data directory "/var/lib/pgsql/10/data"?
oct 30 10:40:40 server systemd[1]: postgresql-10.service: main process exited, code=exited, status=1/FAILURE
oct 30 10:40:40 server systemd[1]: Failed to start PostgreSQL 10 database server.
oct 30 10:40:40 server systemd[1]: Unit postgresql-10.service entered failed state.
oct 30 10:40:40 server systemd[1]: postgresql-10.service failed

Ok, now the Centos service interface shows that the service has failed, due to some postmaster.pid lock file that the postmaster process uses, that's true, the file exists and the postmaster process is still running, the database cluster is still accessible.

I read in the Postgres docs that the Smart Shutdown mode may be waiting for some sessions in the pg_stat_activity to finish.

What can I do to safely restart the cluster with the new wal_level setting and sync the status of the postmaster process and the postgresql-10 service

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.