2017-02-17 105 views
0

我有一个使用PostgreSQL数据库的OpenShift应用程序。OpenShift PostgreSQL数据库还原

我想用'live'数据库中的数据恢复这个数据库。

在本地运行时,我只是删除数据库。然后我创建数据库,然后运行恢复。

但是,当我尝试滴在OpenShift的数据库,它说:

dropdb: database removal failed: ERROR: database "test" is being accessed by other users 

因此,我停止了OpenShift应用程序,然后重试

现在它说:

pg_restore: [archiver (db)] connection to database "test" failed: could not connect to server: No such file or directory 
     Is the server running locally and accepting 
     connections on Unix domain socket "/var/lib/openshift/123456ef0c1e123456789b/postgresql/socket//.s.PGSQL.5432"? 

所以我有一个catch 22的情况。

什么是在OpenShift上恢复PostgreSQL数据库的正确方法?

+0

看来,停止OpenShift也停止了Postgres服务器,这听起来很奇怪。你需要检查OpenShift的东西是否可以配置为不与数据库服务器混淆 –

+0

是的,这似乎是这样的。当我停止OpenShift应用程序时,它也会停止PostgreSQL服务器。但如何解决这个问题... – Lyndon

+0

从postgresql方面(而不是openshift)接近这个问题,你可能想尝试https://dba.stackexchange.com/questions/11893/force-drop-db-while-他人-可待连接 – ynux

回答

0

让Postgresql运行,但停止正在访问数据库的应用程序。就这么简单...