【发布时间】:2018-05-11 07:17:47
【问题描述】:
原来的postgres服务器是在ubuntu上运行的,但是机器死机无法启动。
我尝试在安装了 postgres 的 Ubuntu 上安装磁盘,然后将 data_directory 更改为我安装的原始 data_directoty 的路径,但失败了。
当我运行systemctl start postgresql 时没有错误消息,但是当我尝试使用 psql 登录时,它显示
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
服务器似乎没有打开。我该如何解决?
或者有没有其他方法可以在不启动原机的情况下获取数据库?
【问题讨论】:
-
如果使用相同的数据库版本,应该可以从原来的data_directory恢复。如果不能,则会出现错误消息。您需要找出该服务器无法启动的原因。
-
试试
pg_ctl -D data_directory?.. -
在您执行任何操作之前,对该卷及其上的数据库进行完整备份。
-
我运行
systemctl start postgresql时的日志是2018-05-11 07:53:45 UTC [29628-2] LOG: received smart shutdown request 2018-05-11 07:53:45 UTC [29633-2] LOG: autovacuum launcher shutting down 2018-05-11 07:53:45 UTC [29630-1] LOG: shutting down 2018-05-11 07:53:45 UTC [29630-2] LOG: database system is shut down -
检查服务器是否正在运行(
ps -f -u postgres)。
标签: linux postgresql crash database-backups