Mac 死机后导致 PostgreSQL 无法连接
早上 Mac 死机重启后,postgresql重启始终无效,连接不上, 重启系统依然无解。
PG 的日志文件里看到,/usr/local/var/postgres
目录里面,有一个 server.log
文件可以看到所有的日志。
FATAL: lock file "postmaster.pid" already exists`
`HINT: Is another postmaster (PID 403) running in data directory "/usr/local/var/postgres"?
这行日志就告诉我们 postmaster.pid
已经存在,这就是之前死机前留下的。将此文件删除,问题就可以解决了
解决办法:
sudo rm -rf /usr/local/var/postgres/postmaster.pid
brew services restart postgresql@10