[root@acs-db data]# systemctl status postgresql-12 ● postgresql-12.service - PostgreSQL 12 database server Loaded: loaded (/usr/lib/systemd/system/postgresql-12.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2022-02-24 00:03:52 EST; 6s ago Docs: https://www.postgresql.org/docs/12/static/ Process: 9757 ExecStart=/usr/pgsql-12/bin/postmaster -D ${PGDATA} (code=exited, status=1/FAILURE) Process: 9749 ExecStartPre=/usr/pgsql-12/bin/postgresql-12-check-db-dir ${PGDATA} (code=exited, status=0/SUCCESS) Main PID: 9757 (code=exited, status=1/FAILURE) Feb 24 00:03:52 acs-db systemd[1]: Starting PostgreSQL 12 database server... Feb 24 00:03:52 acs-db postmaster[9757]: 2022-02-24 00:03:52.086 EST [9757] FATAL: data directory "/data/pgsql/12/data" has wrong ownership Feb 24 00:03:52 acs-db systemd[1]: postgresql-12.service: main process exited, code=exited, status=1/FAILURE Feb 24 00:03:52 acs-db systemd[1]: Failed to start PostgreSQL 12 database server. Feb 24 00:03:52 acs-db systemd[1]: Unit postgresql-12.service entered failed state. Feb 24 00:03:52 acs-db systemd[1]: postgresql-12.service failed.
提示文件夹权限问题
修改权限后正常
[root@acs-db pgsql]# chown -R postgres:postgres /data/pgsql/12/data [root@acs-db pgsql]# chmod 0700 /data/pgsql/12/data