0

I need to fix a PostgreSQL Services. Seems that there have been a change to the service. Running pg_ctl start -l logfile works. But the Service fails.

postgres@HOSTNAME ~ > cat /etc/redhat-release
    Red Hat Enterprise Linux Server release 7.3 (Maipo)   

postgres@HOSTNAME ~ > systemctl status postgresql.service
    ● postgresql.service - PostgreSQL database server
       Loaded: loaded (/etc/systemd/system/postgresql.service; enabled; vendor preset: disabled)
       Active: failed (Result: exit-code) since Mi 2018-08-29 14:18:36 CEST; 1h 39min ago
      Process: 14731 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE)

postgres@HOSTNAME ~ > echo $PGDATA
        /var/lib/pgsql/data

$PGDATA seem to be correct. /etc/systemd/system/postgresql.service Looks also fine.

postgres@HOSTNAME data > ls
base          pg_hba.conf_bak  pg_serial     PG_VERSION
global        pg_ident.conf    pg_snapshots  pg_xlog
logfile       pg_log           pg_stat       postgresql.auto.conf
pg_clog       pg_logical       pg_stat_tmp   postgresql.conf
pg_commit_ts  pg_multixact     pg_subtrans   postgresql.conf_bak
pg_dynshmem   pg_notify        pg_tblspc     postmaster.opts
pg_hba.conf   pg_replslot      pg_twophase   postmaster.pid

I did not do the Upgrade. Maybe it was upgraded with zypper or a different DBA did it by installing it prallel and importing the dump.

I checked : Process: 14731 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=1/FAILURE).

# PGVERSION is the full package version, e.g., 9.1.2
# Note: the specfile inserts the correct value during package build
PGVERSION=9.2.24
# PGMAJORVERSION is major version, e.g., 9.1 (this should match PG_VERSION)
PGMAJORVERSION=`echo "$PGVERSION" | sed 's/^\([0-9]*\.[0-9]*\).*$/\1/'`
# PREVMAJORVERSION is the previous major version, e.g., 8.4, for upgrades
# Note: the specfile inserts the correct value during package build
PREVMAJORVERSION=8.4
# PGDOCDIR is the directory containing the package's documentation
# Note: the specfile inserts the correct value during package build
PGDOCDIR=/usr/share/doc/postgresql-9.2.24

The versions don't match.

  • Which OS is this? And which exact PostgreSQL versions (before and after)? How did you upgrade? – dezso Aug 31 '18 at 7:48
  • I added the OS and the uprade type above. – r0tt Aug 31 '18 at 8:29

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.