2017-02-17 96 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運行,但停止正在訪問數據庫的應用程序。就這麼簡單...