journalctl -xe
1、问题1:pg_ctl: another server might be running
pg_ctl: another server might be running
解决方法:删除原来没有删除的pid文件
rm /opt/PostgreSQL/9.4/data/postmaster.pid
2、问题2 postgres文件丢失
- Unit postgresql-9.4.service has begun starting up.
7月 11 09:40:18 localhost.localdomain pg_ctl[1710]: The program "postgres" is needed by pg_ctl but was not found in the
7月 11 09:40:18 localhost.localdomain pg_ctl[1710]: same directory as "/opt/PostgreSQL/9.4/bin/pg_ctl".
7月 11 09:40:18 localhost.localdomain pg_ctl[1710]: Check your installation.
7月 11 09:40:18 localhost.localdomain systemd[1]: postgresql-9.4.service: control process exited, code=exited status=1
7月 11 09:40:18 localhost.localdomain systemd[1]: Failed to start PostgreSQL 9.4 database server.
解决方法:在另外一台安装相同的postgres ,然后把该文件拷贝过来,加权限,指定用户
chmod +x postgres
chown -R postgres:postgres postgres
注:如果看不到日志,可以直接用如下命令启动,日志会输出的控制台
/opt/PostgreSQL/9.4/bin/pg_ctl -w start -D /opt/PostgreSQL/9.4/data
3、参考
1、postgresql 日志配置
2、Mac下启动postgrsql提示another server might be running的解决
3、PostgreSQL官方文档