不能启动postgresql

时间:2018-03-05 03:07:20

标签: postgresql centos7

root@instance $ systemctl status postgresql.service
● postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2018-03-05 02:57:55 UTC; 10s ago
  Process: 1116 ExecStart=/usr/bin/pg_ctl start -D ${PGDATA} -s -o -p ${PGPORT} -w -t 300 (code=exited, status=1/FAILURE)
  Process: 1111 ExecStartPre=/usr/bin/postgresql-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS)

Mar 05 02:57:54 instance-1 systemd[1]: Starting PostgreSQL database server...
Mar 05 02:57:55 instance-1 systemd[1]: postgresql.service: control process exited, code=exited status=1
Mar 05 02:57:55 instance-1 systemd[1]: Failed to start PostgreSQL database server.
Mar 05 02:57:55 instance-1 systemd[1]: Unit postgresql.service entered failed state.
Mar 05 02:57:55 instance-1 systemd[1]: postgresql.service failed.

我做了与此处列出的相同步骤: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-postgresql-on-centos-7

我将所有内容安装为root用户,我应该像其他用户一样安装吗?

# pg_ctl reload
pg_ctl: cannot be run as root
Please log in (using, e.g., "su") as the (unprivileged) user that will
own the server process.

1 个答案:

答案 0 :(得分:2)

对于运行postgresql需要将用户切换到postgres

Su postgres 

Pg_ctl start