我正在尝试使用以下命令在 ubutu 20.04 服务器上启动 postgresql 12:
pg_ctlcluster start 12 main
我从 journalctl 收到以下错误:
A start job for unit [email protected] has begun execution.
--
-- The job identifier is 540857.
Mar 08 13:04:26 server1 postgresql@12-main[107147]: Error: Could not open logfile /var/log/postgresql/postgresql-12-main.log
Mar 08 13:04:26 server1 postgresql@12-main[107134]: Error: /usr/lib/postgresql/12/bin/pg_ctl /usr/lib/postgresql/12/bin/pg_ctl start -D /var/lib/postgresql/12/main -l /var/log/postgresql/postgresql-12-main.log -s -o -c config_file="/etc/postgresql/12/main/postgresql.conf" exited with status 1:
Mar 08 13:04:26 server1 systemd[1]: [email protected]: Can't open PID file /run/postgresql/12-main.pid (yet?) after start: Operation not permitted
Mar 08 13:04:26 server1 systemd[1]: [email protected]: Failed with result 'protocol'.
-- Subject: Unit failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- The unit [email protected] has entered the 'failed' state with result 'protocol'.
我尝试将日志文件的所有者更改为 postgres,并使用 更改目录的权限chmod 700 -R /var/log/postgresql
,但仍然出现相同的错误。文件 PID 文件 /run/postgresql/12-main.pid 似乎未创建。如何修复此问题并启动我的数据库?