我以 postgres 用户身份运行 pgpool-II,因此我可以在这篇文章中以一个顺序准确地复制我所做的事情。
-bash-4.2$ echo "pgpool:$(pg_md5 test)" > /etc/pgpool-II-11/pcp.conf
-bash-4.2$ cat /etc/pgpool-II-11/pcp.conf
pgpool:098f6bcd4621d373cade4e832627b4f6
<Restart pgpool-II-11 service>
-bash-4.2$ echo "cia-db-vip:9898:pgpool:$(pg_md5 test)" > .pcppass
-bash-4.2$ cat .pcppass
cia-db-vip:9898:pgpool:098f6bcd4621d373cade4e832627b4f6
-bash-4.2$ pcp_watchdog_info -h cia-db-vip -p 9898 -U pgpool -w 0
FATAL: authentication failed for user "pgpool"
DETAIL: username and/or password does not match
-bash-4.2$ pcp_watchdog_info -h cia-db-vip -p 9898 -U pgpool 0
Password: <I Enter the password test>
2 YES cia-db-3:9999 Linux cia-db-3 cia-db-3
cia-db-3:9999 Linux cia-db-3 cia-db-3 9999 9000 4 MASTER
-bash-4.2$ ls -l .pcppass /etc/pgpool-II-11/pcp.conf
-rw-------. 1 postgres postgres 40 Jul 30 11:22 /etc/pgpool-II-11/pcp.conf
-rw-------. 1 postgres postgres 56 Jul 30 11:23 .pcppass
所以只有我输入密码才能工作。我也试过在没有密码的情况下按回车键。
我尝试检查 strace -ff pcp_watchdog_info 并开始读取文件 .pcppass 但我只能看到第一行。不知道它是继续读取文件还是关闭它。
stat("/var/lib/pgsql/.pcppass", {st_mode=S_IFREG|0600, st_size=56, ...}) = 0
open("/var/lib/pgsql/.pcppass", O_RDONLY) = 4
fstat(4, {st_mode=S_IFREG|0600, st_size=56, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f581f3d6000
read(4, "cia-db-vip:9898:pgpool:098f6bcd4"..., 4096) = 56
close(4) = 0
munmap(0x7f581f3d6000, 4096) = 0
write(3, "M\0\0\0\4", 5) = 5
select(4, [3], NULL, [3], NULL) = 1 (in [3])
read(3, "m\0\0\0\10\205^\v\341", 1024) = 9
write(3, "R\0\0\0,pgpool\000381d652cc9ef7891d4cb"..., 45) = 45
select(4, [3], NULL, [3], NULL) = 1 (in [3])
read(3, "E\0\0\0xSFATAL\0CXX000\0Mauthenticati"..., 1024) = 121
close(3) = 0
write(2, "FATAL: authentication failed fo"..., 98FATAL: authentication failed for user "pgpool"
DETAIL: username and/or password does not match
我还尝试重置 postgres 用户 pgpool 密码以进行测试,包括在 /etc/pgpool-II-11/pool_passwd 中,但我怀疑它是否重要,因为如果我输入密码,我实际上可以使用 pcp 命令。因此,用户似乎与 postgres 用户是分开的。
编辑:还尝试将 SElinux 临时设置为 permissive,但没有帮助。