重庆思庄Oracle、Redhat认证学习论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 191|回复: 0
打印 上一主题 下一主题

repmgr 做备库克隆时报no password supplied

[复制链接]
跳转到指定楼层
楼主
发表于 2024-12-28 17:04:16 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
如下报错:

[postgres@db124 ~]$ repmgr -h 192.168.133.122 -U repmgr -d repmgr -f /u01/app/postgres/repmgr.conf  standby clone --dry-run
NOTICE: destination directory "/u01/app/postgres/pgdata" provided
INFO: connecting to source node
DETAIL: connection string is: host=192.168.133.122 user=repmgr dbname=repmgr
ERROR: connection to database failed
DETAIL:
fe_sendauth: no password supplied


这种错误,应该是.pgpass文件配置有问题。

检查 .pgpass文件:

[postgres@db124 ~]$ cat /home/postgres/.pgpass
cat: /home/postgres/.pgpass: 没有那个文件或目录


没有对应的文件,手工建立即可
[postgres@db124 ~]$ cat /home/postgres/.pgpass
192.168.133.122:5432:repmgr:repmgr:repmgr
192.168.133.124:5432:repmgr:repmgr:repmgr


之后,再去执行

[postgres@db124 ~]$ repmgr -h 192.168.133.122 -U repmgr -d repmgr -f /u01/app/postgres/repmgr.conf  standby clone --dry-run
NOTICE: destination directory "/u01/app/postgres/pgdata" provided
INFO: connecting to source node
DETAIL: connection string is: host=192.168.133.122 user=repmgr dbname=repmgr
WARNING: password file "/home/postgres/.pgpass" has group or world access; permissions should be u=rw (0600) or less
ERROR: connection to database failed
DETAIL:
fe_sendauth: no password supplied


这时还需要设置权限位0600

[postgres@db124 ~]$ chmod 600 /home/postgres/.pgpass
[postgres@db124 ~]$ ls -ltr /home/postgres/.pgpass
-rw------- 1 postgres postgres 85 12月 28 17:01 /home/postgres/.pgpass


之后,再去执行,就不报错了。
[postgres@db124 ~]$ repmgr -h 192.168.133.122 -U repmgr -d repmgr -f /u01/app/postgres/repmgr.conf  standby clone --dry-run
NOTICE: destination directory "/u01/app/postgres/pgdata" provided
INFO: connecting to source node
DETAIL: connection string is: host=192.168.133.122 user=repmgr dbname=repmgr
DETAIL: current installation size is 221 MB
INFO: "repmgr" extension is installed in database "repmgr"
WARNING: target data directory appears to be a PostgreSQL data directory
DETAIL: target data directory is "/u01/app/postgres/pgdata"
HINT: use -F/--force to overwrite the existing data directory
INFO: replication slot usage not requested;  no replication slot will be set up for this standby
INFO: parameter "max_wal_senders" set to 10
NOTICE: checking for available walsenders on the source node (2 required)
INFO: sufficient walsenders available on the source node
DETAIL: 2 required, 10 available
NOTICE: checking replication connections can be made to the source server (2 required)
INFO: required number of replication connections could be made to the source server
DETAIL: 2 replication connections required
WARNING: data checksums are not enabled and "wal_log_hints" is "off"
DETAIL: pg_rewind requires "wal_log_hints" to be enabled
NOTICE: standby will attach to upstream node 122
HINT: consider using the -c/--fast-checkpoint option
INFO: would execute:
  pg_basebackup -l "repmgr base backup"  -D /u01/app/postgres/pgdata -h 192.168.133.122 -p 5432 -U repmgr -X stream
INFO: all prerequisites for "standby clone" are met









分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 支持支持 反对反对
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|手机版|小黑屋|重庆思庄Oracle、Redhat认证学习论坛 ( 渝ICP备12004239号-4 )

GMT+8, 2025-2-5 16:46 , Processed in 0.085899 second(s), 20 queries .

重庆思庄学习中心论坛-重庆思庄科技有限公司论坛

© 2001-2020

快速回复 返回顶部 返回列表