我在 artix 上使用 runit postgresql 启动后遇到问题
#sudo sv start postgresql
ok: run: postgresql: (pid 849) 1236s
#sudo -u postgres psql
psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: No such file or directory
Is the server running locally and accepting connections on that socket?
#sudo sv status postgresql
down: postgresql: 0s, normally up, want up; run: log: (pid 854) 1273s
主要是它的启动,然后在我检查其状态后,它提示我服务已关闭
sudo sv start postgresql
ok: run: postgresql: (pid 11583) 0s
sudo sv status postgresql
down: postgresql: 0s, normally up, want up; run: log: (pid 854) 59
/var/log/postgresql/@400000006611a7623ac93f6c.u
2024-04-06_19:09:52.09176 postgres: could not access the server configuration file "/var/lib/postgres/data/postgresql.conf": No such file or directory
当我手动启动它时:
➜ postgresql sudo ./run
2024-04-07 21:21:42.964 GMT [19108] LOG: skipping missing configuration file "/var/lib/postgres/data/postgresql.auto.conf"
2024-04-07 21:21:42.964 GMT [19108] FATAL: "/var/lib/postgres/data" is not a valid data directory
2024-04-07 21:21:42.964 GMT [19108] DETAIL: File "/var/lib/postgres/data/PG_VERSION" is missing.
答案1
修复它
#FATAL: "/var/lib/postgres/data" is not a valid data directory
rm /var/lib/postgres/data
sv start postgresql