简体   繁体   English

如何使用 Heroku 运行 pg_dumpall?

[英]How can I run pg_dumpall with Heroku?

How can I use pg_dumpall with Heroku?如何在 Heroku 中使用pg_dumpall The default "database backup" feature from Heroku is pg_dump with the click of a button, which doesn't include roles, so I want to do pg_dumpall ... I'm trying pg_dumpall -h myherokuurl.compute-1.amazonaws.com -l mypassword -U myUser > dump.sql Heroku 的默认“数据库备份”功能是pg_dump ,只需单击一个按钮,其中不包括角色,所以我想做pg_dumpall ......我正在尝试pg_dumpall -h myherokuurl.compute-1.amazonaws.com -l mypassword -U myUser > dump.sql

I'm getting this error:我收到此错误:

pg_dumpall: error: query failed: ERROR:  permission denied for table pg_authid
pg_dumpall: error: query was: SELECT oid, rolname, rolsuper, rolinherit, rolcreaterole, rolcreatedb, rolcanlogin, rolconnlimit, rolpassword, rolvaliduntil, rolreplication, rolbypassrls, pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, rolname = current_user AS is_current_user FROM pg_authid WHERE rolname !~ '^pg_' ORDER BY 2

My first thought was to create a new user with the correct privileges.我的第一个想法是创建一个具有正确权限的新用户。 So, I logged using heroku pg:psql DATABASE -a my-app-name then tried create user myUser with password 'mypassword' but got the error ERROR: permission denied to create role因此,我使用heroku pg:psql DATABASE -a my-app-name然后尝试create user myUser with password 'mypassword'但收到错误ERROR: permission denied to create role

I'm honestly not sure what's going on I'm kind of just guessing.老实说,我不确定发生了什么,我只是在猜测。 Any troubleshooting ideas would be appreciated!任何故障排除的想法将不胜感激! (in the meantime I'm just trying to learn more about Postgres) (与此同时,我只是想了解更多关于 Postgres 的信息)

If your problem is just about the pg_authid catalog, you should be able to use recent versions of pg_dumpall with the --no-role-passwords option .如果您的问题仅与pg_authid目录有关,您应该能够使用带有--no-role-passwords选项pg_dumpall最新版本。

This commonly works in hosted environments where pg_authid is inaccesible, eg on AWS.这通常适用于pg_authid托管环境,例如在 AWS 上。 The only downside is that the passwords of Postgres users will be missing from the dump.唯一的缺点是 Postgres 用户的密码将从转储中丢失。

However, you appear to have a more limited, perhaps shared environment, where you can't even create new Postgres users.但是,您的环境似乎更加有限,可能是共享环境,您甚至无法在其中创建新的 Postgres 用户。 I am not certain if there is any chance to get pg_dumpall working there.我不确定是否有机会让pg_dumpall在那里工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM