How to restart PostgreSQL server under CentOS 7

2018-02-02 21:24:32

I installed PostgreSQL 10.1 under a CentOS 7.3 environment.

The service is started (postmaster.pid file present under /var/lib/pgsql/10/data), but I need to reload configuration or restart the server following a change in pg_hba.conf.

However, trying different commands, I get the following:

pg_ctl reload -D /var/lib/pgsql/10/data

bash: pg_ctl: command not found

service postgresql reload

Redirecting to /bin/systemctl reload postgresql.service

Failed to reload postgresql.service: Unit not found.

I found out that you need to specify the exact name for the PostgreSQL service, which you can find under the list of services, using systemctl (also see this post):

systemctl list-units|grep postgresql

postgresql-10.service loaded active running PostgreSQL 10 database server

Then you can use service:

service postgresql-10.service reload

or

service postgresql-10.service restart

Alternatively, yo

  • I found out that you need to specify the exact name for the PostgreSQL service, which you can find under the list of services, using systemctl (also see this post):

    systemctl list-units|grep postgresql

    postgresql-10.service loaded active running PostgreSQL 10 database server

    Then you can use service:

    service postgresql-10.service reload

    or

    service postgresql-10.service restart

    Alternatively, you can use the systemctl command:

    /bin/systemctl reload postgresql-10.service

    or

    /bin/systemctl restart postgresql-10.service

    2018-02-02 21:25:32
  • According this link below there's not reload command for PostgreSQL but restart

    https://www.ehowstuff.com/how-to-start-stop-restart-postgresql-database-server-on-linux-centos-6-2-server/

    2018-02-02 21:37:04