Postgresql 启动失败
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20642892/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Postgresql starting failed
提问by Michal M.
I was connected with remote postgres-9.3 by pgAdmin III. After close pgAdmin i try to connect on another day with the same db.
我通过 pgAdmin III 连接到远程 postgres-9.3。关闭 pgAdmin 后,我尝试在另一天使用相同的数据库连接。
/etc/init.d/postgresql-9.3 status dead but pid file exists
service postgresql-9.3 start FAIL
In pgstartup.log file i have:
在 pgstartup.log 文件中,我有:
This account is currently not available
pg_hba.conf:
pg_hba.conf:
# "local" is for Unix domain socket connections only local all all peer host all all 127.0.0.1/32 trust host all all 89.70.224.82/32 md5
Operating system on server is CentOS. I don't know unfortunately how postgres was installed on the server because someone else done that. What i can do with this?
服务器上的操作系统是 CentOS。不幸的是,我不知道 postgres 是如何安装在服务器上的,因为其他人这样做了。我可以用这个做什么?
回答by Nandu Software Engineer
The solution is reset your PostgreSQL logs
解决方案是重置您的 PostgreSQL 日志
[root@user /]#/usr/pgsql-9.3/bin/pg_resetxlog -f /usr/pgsql-9.3/data/
after executing above command display "Transaction log reset"
执行上述命令后显示“事务日志重置”
and then restart PostgreSQL server
然后重启 PostgreSQL 服务器
[root@user /]# /etc/init.d/postgresql-9.3 restart
Stopping postgresql-9.3 service: [FAILED]
Starting postgresql-9.3 service: [ OK ]
[root@qa /]# /etc/init.d/postgresql-9.3 status
(pid 3003) is running...
after checking your pgadmin
检查您的 pgadmin 后
回答by zhigaev
Try to start cluster using native postgres utility. Assuming you have CentOS 6.6 and postgresql 9.4
尝试使用本机 postgres 实用程序启动集群。假设你有 CentOS 6.6 和 postgresql 9.4
sudo -u postgres /usr/pgsql-9.4/bin/pg_ctl -D <YOUR_DATA_DIR> start
sudo -u postgres /usr/pgsql-9.4/bin/pg_ctl -D <YOUR_DATA_DIR> start
You will get some reasonable output. Then try to start postgres in single user mode
你会得到一些合理的输出。然后尝试在单用户模式下启动 postgres
sudo -u postgres /usr/pgsql-9.4/bin/postgres --single -D <YOUR_DATA_DIR> -P -d 1
sudo -u postgres /usr/pgsql-9.4/bin/postgres --single -D <YOUR_DATA_DIR> -P -d 1
Beware that resetting xlogs will cause some data lost. I also recommend to read this article http://blog.endpoint.com/2014/11/when-postgres-will-not-start.html
请注意,重置 xlogs 会导致一些数据丢失。我还建议阅读这篇文章http://blog.endpoint.com/2014/11/when-postgres-will-not-start.html