gpt4 book ai didi

postgresql - 无法连接到 Postgres 服务器

转载 作者:行者123 更新时间:2023-11-29 12:44:35 24 4
gpt4 key购买 nike

我正在尝试运行 pg_basebackup 以创建从属服务器,但我不断收到此错误:

pg_basebackup: could not connect to server: could not connect to server: No route to host
Is the server running on host "192.168.1.164" and accepting
TCP/IP connections on port 5432?

192.168.1.164 服务器上,postgresql.conf 文件有:

listen_addresses = '*' # originally 'localhost, 192.168.1.63'
port = 5432

pg_hba.conf 文件有:

host    replication     replicator      192.168.1.63/32 md5

其中 192.168.1.63 是从服务器。

两台机器之间的链接很好,因为我可以使用这些 IP 从其中一台 SSH 连接到另一台。此外,服务 postgresql 在主服务器上启动,在从服务器上停止。 master 有一个 Postgres 用户 replicator

我在两台机器上都运行 PostgreSQL 9.4.4 和 Fedora 22。

编辑:从主人的 psql 运行 SHOW config_file;SHOW hba_file; 与我一直在编辑的文件相匹配,当然,服务器已重新启动编辑后。

最佳答案

事实证明这是防火墙问题。解决方案是这样的:

firewall-cmd --permanent --add-port=5432/tcp
firewall-cmd --add-port=5432/tcp

注意:我来自未屏蔽此端口的 Ubuntu,所以我没有意识到它需要打开。

关于postgresql - 无法连接到 Postgres 服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31611674/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com