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

标题: repmgr 做备库克隆时报no password supplied [打印本页]

作者: 郑全    时间: 2024-12-28 17:04
标题: repmgr 做备库克隆时报no password supplied
如下报错:

[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














欢迎光临 重庆思庄Oracle、Redhat认证学习论坛 (http://bbs.cqsztech.com/) Powered by Discuz! X3.2