无法连接到生产数据库以获取自定义pg_dump

时间:2015-07-23 12:04:56

标签: heroku heroku-postgres

我正在使用heroku pg:credentials在生产数据库上尝试psql。当我尝试转储时,需要很长时间并且给我这个错误:

  

SSL SYSCALL错误:操作超时

但是,使用pg_dump -s -h abcded.compute.amazonaws.com -d adflaksjdfl23 -U username -p 5512 Password: 命令使用相同的凭据连接到数据库可以正常工作。

我试过

pg_dump: [archiver (db)] query failed: SSL SYSCALL error: Operation timed out
pg_dump: [archiver (db)] query was: SELECT c.tableoid, c.oid, c.relname, c.relacl, c.relkind, c.relnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = c.relowner) AS rolname, c.relchecks, c.relhastriggers, c.relhasindex, c.relhasrules, c.relhasoids, c.relfrozenxid, c.relminmxid, tc.oid AS toid, tc.relfrozenxid AS tfrozenxid, tc.relminmxid AS tminmxid, c.relpersistence, c.relispopulated, 'd' AS relreplident, c.relpages, CASE WHEN c.reloftype <> 0 THEN c.reloftype::pg_catalog.regtype ELSE NULL END AS reloftype, d.refobjid AS owning_tab, d.refobjsubid AS owning_col, (SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, array_to_string(array_remove(array_remove(c.reloptions,'check_option=local'),'check_option=cascaded'), ', ') AS reloptions, CASE WHEN 'check_option=local' = ANY (c.reloptions) THEN 'LOCAL'::text WHEN 'check_option=cascaded' = ANY (c.reloptions) THEN 'CASCADED'::text ELSE NULL END AS checkoption, array_to_string(array(SELECT 'toast.' || x FROM unnest(tc.reloptions) x), ', ') AS toast_reloptions FROM pg_class c LEFT JOIN pg_depend d ON (c.relkind = 'S' AND d.classid = c.tableoid AND d.objid = c.oid AND d.objsubid = 0 AND d.refclassid = c.tableoid AND d.deptype = 'a') LEFT JOIN pg_class tc ON (c.reltoastrelid = tc.oid) WHERE c.relkind in ('r', 'S', 'v', 'c', 'm', 'f') ORDER BY c.oid

结果:

{{1}}

1 个答案:

答案 0 :(得分:0)

我不确定为什么它会失败,但如果它有效,你可以使用Heroku工具带捕获转储并下载它。

这可以通过两个简单的步骤完成:

heroku pg:backups capture --app app-name
curl -o latest.dump `heroku pg:backups public-url --app-name`

https://devcenter.heroku.com/articles/heroku-postgres-import-export#export