【发布时间】:2018-05-18 21:06:53
【问题描述】:
我试过了
- 设置.pgpass的权限为0600
- 已确认 .pgpass 位于我用户的主目录 (/home/brandon/.pgpass) 中
- 在 pg_dumpall 命令中使用 -w
- 确认 .pgpass 中的数据正确
如果我一次又一次地输入密码,自动备份的脚本 (https://wiki.postgresql.org/wiki/Automated_Backup_on_Linux) 就可以工作,这就是我在所有命令中添加 -w 的原因。由于某种原因,它不读取 .pgpass 文件。
有多个错误消息,但它们通常是这样的。
pg_dumpall: could not connect to database "template1": FATAL: password authentication failed for user "postgres"
致命:用户“postgres”的密码验证失败
pg_pass 文件:
localhost:5432:my_db:postgres:password
命令行:
username@droplet:~/ProjectDir$ bash cronjob/db_backup/pg_backup.sh
Making backup directory in /home/backups/database/postgresql/2017-12-06/
Performing globals backup
--------------------------------------------
Globals backup
cronjob/db_backup/pg_backup.sh: line 80: /home/backups/database/postgresql/2017-12-06/globals.sql.gz.in_progress: Permission denied
pg_dumpall: could not connect to database "template1": fe_sendauth: no password supplied
[!!ERROR!!] Failed to produce globals backup
Performing schema-only backups
--------------------------------------------
psql: fe_sendauth: no password supplied
The following databases were matched for schema-only backup:
Performing full backups
--------------------------------------------
psql: fe_sendauth: no password supplied
All database backups complete!
【问题讨论】:
-
查看 PostgreSQL 服务器日志。显示您的 .pgpass 文件(不包括密码)和命令行。
-
我添加了 pgpass 和命令行输出,打算弄清楚如何找到服务器日志
标签: postgresql