我有一個帶有postgresql數據庫的Heroku應用程序我試圖預先填充在本地主機postgresql安裝上創建的數據。將本地postgresql數據庫數據複製到遠程heroku數據庫的問題
我一直在遵循從Heroku的詳細說明這裏:https://devcenter.heroku.com/articles/heroku-postgres-import-export和在這裏:https://devcenter.heroku.com/articles/pgbackups#restoring-from-backup但仍然遇到一個問題,似乎相當神祕的我。
PGPASSWORD=password pg_dump -o -Fc --no-acl --no-owner -h localhost -U dbUser db_name > db/db_name.dump
我然後按照說明我的轉儲文件上傳到雲應用程序的URL,並嘗試後用下面的恢復數據庫:
首先,我已經使用這個命令創建了本地數據庫啞命令:
heroku pgbackups:restore DATABASE_NAME 'http://path/to/db_name.dump' --app app_name
下面的輸出有錯誤的打印: 檢索...做
! An error occurred and your restore did not finish.
! Please run `heroku logs --ps pgbackups` for details.
當我查看日誌時,發現下面的輸出是抱怨一個整數,然後是一個「無效路徑」,但我無法理解爲什麼。轉儲文件的URL是正確和可訪問的。
對此問題的任何深入瞭解都非常感謝!
2013-02-04T20:15:06+00:00 app[pgbackups]: Started: Mon Feb 4 20:15:06 UTC 2013
2013-02-04T20:15:06+00:00 app[pgbackups]: Location: e9d564f0-a67f-4c32-bad5-60798786b87b:/tmp/VFJ5WDiAHr
2013-02-04T20:15:07+00:00 app[pgbackups]: psql: bin//psql-9.2.1-64bit
2013-02-04T20:15:07+00:00 app[pgbackups]: pv: bin//pv-1.1.4-64bit
2013-02-04T20:15:07+00:00 app[pgbackups]: SELECT count(*) = 0 as is_empty
2013-02-04T20:15:07+00:00 app[pgbackups]: FROM pg_class INNER JOIN pg_roles ON relowner = pg_roles.oid
2013-02-04T20:15:07+00:00 app[pgbackups]: WHERE rolname <> '\''postgres'\'''
2013-02-04T20:15:07+00:00 app[pgbackups]: bin/brie: line 145: [: 9.1: integer expression expected
2013-02-04T20:15:07+00:00 app[pgbackups]: pg_restore: bin//pg_restore-9.1.6-64bit
2013-02-04T20:15:07+00:00 app[pgbackups]: Schema | Name | Type | Info
2013-02-04T20:15:07+00:00 app[pgbackups]: --------+-------------------------------+-------+-------------------
2013-02-04T20:15:07+00:00 app[pgbackups]: public | abilities | table | 554
2013-02-04T20:15:07+00:00 app[pgbackups]: public | abilities | table | abilities_pkey
2013-02-04T20:15:07+00:00 app[pgbackups]: public | champions | table | 110
2013-02-04T20:15:07+00:00 app[pgbackups]: public | champions | table | champions_pkey
2013-02-04T20:15:07+00:00 app[pgbackups]: public | effects | table | 934
2013-02-04T20:15:07+00:00 app[pgbackups]: public | effects | table | effects_pkey
2013-02-04T20:15:07+00:00 app[pgbackups]: public | items | table | 191
2013-02-04T20:15:07+00:00 app[pgbackups]: public | items | table | items_pkey
2013-02-04T20:15:07+00:00 app[pgbackups]: public | masteries | table | 56
2013-02-04T20:15:07+00:00 app[pgbackups]: public | masteries | table | masteries_pkey
2013-02-04T20:15:07+00:00 app[pgbackups]: public | runes | table | 305
2013-02-04T20:15:07+00:00 app[pgbackups]: public | runes | table | runes_pkey
2013-02-04T20:15:07+00:00 app[pgbackups]: public | schema_migrations | table | 26
2013-02-04T20:15:07+00:00 app[pgbackups]: public | schema_migrations | table |
2013-02-04T20:15:07+00:00 app[pgbackups]: public | spells | table | 15
2013-02-04T20:15:07+00:00 app[pgbackups]: public | spells | table | spells_pkey
2013-02-04T20:15:07+00:00 app[pgbackups]: public | abilities_pkey | index | abilities
2013-02-04T20:15:07+00:00 app[pgbackups]: public | champions_pkey | index | champions
2013-02-04T20:15:07+00:00 app[pgbackups]: public | effects_pkey | index | effects
2013-02-04T20:15:07+00:00 app[pgbackups]: public | index_champions_on_updated_at | index | champions
2013-02-04T20:15:07+00:00 app[pgbackups]: public | index_items_on_item_id | index | items
2013-02-04T20:15:07+00:00 app[pgbackups]: public | index_items_on_updated_at | index | items
2013-02-04T20:15:07+00:00 app[pgbackups]: public | index_masteries_on_updated_at | index | masteries
2013-02-04T20:15:07+00:00 app[pgbackups]: public | index_runes_on_updated_at | index | runes
2013-02-04T20:15:07+00:00 app[pgbackups]: public | index_spells_on_updated_at | index | spells
2013-02-04T20:15:07+00:00 app[pgbackups]: public | items_pkey | index | items
2013-02-04T20:15:07+00:00 app[pgbackups]: public | masteries_pkey | index | masteries
2013-02-04T20:15:07+00:00 app[pgbackups]: public | runes_pkey | index | runes
2013-02-04T20:15:07+00:00 app[pgbackups]: public | spells_pkey | index | spells
2013-02-04T20:15:07+00:00 app[pgbackups]: public | unique_schema_migrations | index | schema_migrations
2013-02-04T20:15:07+00:00 app[pgbackups]: (30 rows)
2013-02-04T20:15:07+00:00 app[pgbackups]:
2013-02-04T20:15:07+00:00 app[pgbackups]: download_progress: start
2013-02-04T20:15:07+00:00 app[pgbackups]: download_progress: 0B
2013-02-04T20:15:07+00:00 app[pgbackups]:
2013-02-04T20:15:07+00:00 app[pgbackups]: download_progress: 0.0bytes
2013-02-04T20:15:07+00:00 app[pgbackups]: download_progress: done
2013-02-04T20:15:07+00:00 app[pgbackups]: Invalid path
我會看看使用捲曲選項來解決這個問題。非常感謝您的快速響應! – gdavis
事實上,使用'curl -I'來查找最終的URL是正確的解決方案。謝謝! – gdavis
好奇:使用'https:'做同樣的cloudapp網址工作嗎? – catsby