2012-11-13 1 views
1

기존 Heroku 앱에서 내 로컬 컴퓨터로 데이터베이스를 다운로드했습니다. 다운로드 한 데이터는 하나의 파일에 있습니다. 그것을 herokuapp.db라고 부르 자. 또한 Postgres를 설치했는데 새로운 Postgres 데이터베이스를 성공적으로 만들 수 있으며이를 참조 할 수 있습니다. 내가 원하는 것은 Heroku에서 다운로드 한 데이터를이 데이터베이스로 옮기거나 다운로드 한 데이터를 사용하여 새로운 Postgres 데이터베이스를 만드는 것입니다.Heroku Postgres 데이터베이스를 Rails 3 앱에서 로컬로 사용

답변

2

사용 pg_restore --verbose --clean --no-acl --no-owner -d [database_name] [herokuapp.db] 난 그냥 제안 것인가 유사한 기술과 같은 문제를 해결 자세한 내용

+0

그라시아을 :

여기
pg_restore: connecting to database for restore pg_restore: [archiver (db)] connection to database "[database_name]" failed: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"? pg_restore: *** aborted because of error 

는 일 업데이트 된 명령입니다. – wuliwong

1

에 대한 https://devcenter.heroku.com/articles/export-from-heroku-postgres를 참조 (감사 윌를!).

$ heroku pgbackups:capture 
$ curl -o latest.dump `heroku pgbackups:url` 
$ pg_restore --verbose --clean --no-acl --no-owner -d [database_name] latest.dump 

database_name은 database.yml 파일의 개발 섹션에서 찾을 수 있습니다.

나는 최근 Postgres.app 다시이 작업을 수행하고 마지막 명령은 위에서 작동하지 않았다
편집 할 수 있습니다. 이 오류 메시지가 표시되었습니다 그것을했다

$ pg_restore --verbose --clean --no-acl --no-owner -h localhost -U $USER -d [database_name] latest.dump