简体   繁体   English

将 TLS 服务器与 pgBackRest 一起使用时出错:[113] 没有到主机的路由

[英]Error when using TLS server with pgBackRest : [113] No route to host

I´m trying to implement the TLS server feature available with pgBackRest to use a secure connection between the DB server and the repo server, replacing the previous SSH passwordless setup (that was working fine).我正在尝试实现pgBackRest提供的TLS服务器功能,以使用数据库服务器和 repo 服务器之间的安全连接,替换以前的 SSH 无密码设置(工作正常)。

After following the online documentation , I´m having the following error when issuing the stanza-create command:遵循在线文档后,发出stanza-create命令时出现以下错误:

pgbackrest@pgb-repo$ pgbackrest --stanza=training --log-level-console=info stanza-create
2022-06-13 12:56:55.677 P00   INFO: stanza-create command begin 2.39: --buffer-size=16MB --exec-id=8994-62e5ecac --log-level-console=info --log-level-file=info --pg1-host=pg1-primary --pg1-host-ca-file=/etc/pgbackrest/cert/ca.crt --pg1-host-cert-file=/etc/pgbackrest/cert/pg1-primary.crt --pg1-host-key-file=/etc/pgbackrest/cert/pg1-primary.key --pg1-host-type=tls --pg1-host-user=postgres --pg1-path=/data/postgres/13/pg_data --repo1-path=/backup/pgbackrest --stanza=training
WARN: unable to check pg1: [HostConnectError] unable to connect to 'pg1-primary:8432': [113] No route to host
ERROR: [056]: unable to find primary cluster - cannot proceed
       HINT: are all available clusters in recovery?
2022-06-13 12:58:55.835 P00   INFO: stanza-create command end: aborted with exception [056]

The PostgreSQL server is up and running on the the DB host: PostgreSQL 服务器已启动并在 DB 主机上运行:

[postgres@pg1-primary ~]$ psql -c "SELECT pg_is_in_recovery();"
 pg_is_in_recovery
-------------------
 f
(1 row)

Question问题

Why am I having this [113] No route to host error?为什么我有这个[113] No route to host错误?

Configuration for each server:每个服务器的配置:

pg1-primary pg1-primary

[postgres@pg1-primary ~]$ cat /etc/pgbackrest/pgbackrest.conf
[global]
repo1-path=/backup/pgbackrest
repo1-host-ca-file=/etc/pgbackrest/cert/ca.crt
repo1-host-cert-file=/etc/pgbackrest/cert/pgb-repo.crt
repo1-host-key-file=/etc/pgbackrest/cert/pgb-repo.key
repo1-host-type=tls
tls-server-address=*
tls-server-auth=pgb-repo=training
tls-server-ca-file=/etc/pgbackrest/cert/ca.crt
tls-server-cert-file=/etc/pgbackrest/cert/pg1-primary.crt
tls-server-key-file=/etc/pgbackrest/cert/pg1-primary.key
[postgres@pg1-primary ~]$ cat /etc/pgbackrest/conf.d/training.conf
[training]
pg1-path=/data/postgres/13/pg_data
pg1-socket-path=/tmp
repo1-host=pgb-repo
repo1-host-user=pgbackrest
[postgres@pg1-primary ~]$ ll /etc/pgbackrest/cert/
total 20
-rw-------. 1 postgres postgres 1090 Jun 13 12:12 ca.crt
-rw-------. 1 postgres postgres  977 Jun 13 12:12 pg1-primary.crt
-rw-------. 1 postgres postgres 1708 Jun 13 12:12 pg1-primary.key
-rw-------. 1 postgres postgres  977 Jun 13 12:23 pgb-repo.crt
-rw-------. 1 postgres postgres 1704 Jun 13 12:23 pgb-repo.key

pgb-repo pgb-repo

pgbackrest@pgb-repo$ cat /etc/pgbackrest/pgbackrest.conf
[global]
repo1-path=/backup/pgbackrest
tls-server-address=*
tls-server-auth=pg1-primary=training
tls-server-ca-file=/etc/pgbackrest/cert/ca.crt
tls-server-cert-file=/etc/pgbackrest/cert/pgb-repo.crt
tls-server-key-file=/etc/pgbackrest/cert/pgb-repo.key
pgbackrest@pgb-repo$ cat /etc/pgbackrest/conf.d/training.conf
[training]
pg1-host=pg1-primary
pg1-host-user=postgres
pg1-path=/data/postgres/13/pg_data
pg1-host-ca-file=/etc/pgbackrest/cert/ca.crt
pg1-host-cert-file=/etc/pgbackrest/cert/pg1-primary.crt
pg1-host-key-file=/etc/pgbackrest/cert/pg1-primary.key
pg1-host-type=tls
pgbackrest@pgb-repo$ ll /etc/pgbackrest/cert/
total 20
-rw-------. 1 pgbackrest pgbackrest 1090 Jun 13 12:27 ca.crt
-rw-------. 1 pgbackrest pgbackrest  977 Jun 13 12:27 pg1-primary.crt
-rw-------. 1 pgbackrest pgbackrest 1708 Jun 13 12:27 pg1-primary.key
-rw-------. 1 pgbackrest pgbackrest  977 Jun 13 12:27 pgb-repo.crt
-rw-------. 1 pgbackrest pgbackrest 1704 Jun 13 12:27 pgb-repo.key

The servers are reachable from one another:服务器可以相互访问:

[postgres@pg1-primary ~]$ ping pgb-repo
PING pgb-repo.xxxx.com (XXX.XX.XXX.117) 56(84) bytes of data.
64 bytes from pgb-repo.xxxx.com (XXX.XX.XXX.117): icmp_seq=1 ttl=64 time=0.365 ms
64 bytes from pgb-repo.xxxx.com (XXX.XX.XXX.117): icmp_seq=2 ttl=64 time=0.421 ms
pgbackrest@pgb-repo$ ping pg1-primary
PING pg1-primary.xxxx.com (XXX.XX.XXX.116) 56(84) bytes of data.
64 bytes from pg1-primary.xxxx.com (XXX.XX.XXX.116): icmp_seq=1 ttl=64 time=0.325 ms
64 bytes from pg1-primary.xxxx.com (XXX.XX.XXX.116): icmp_seq=2 ttl=64 time=0.298 ms

So actually the issue had to do with the firewall preventing access to the default TLS port (8432) used by pgBackRest.所以实际上这个问题与防火墙阻止访问 pgBackRest 使用的默认 TLS 端口(8432)有关。

[root@pgb-server ~]# firewall-cmd --zone=public --add-port=8432/tcp --permanent
[root@pgb-server ~]# firewall-cmd --reload

Once the port was accessible through the firewall I could issue a telnet command successfully (for testing access) - and of course run my pgBackRest commands too.一旦端口可以通过防火墙访问,我就可以成功发出 telnet 命令(用于测试访问)——当然也可以运行我的 pgBackRest 命令。

[pgbackrest@pgb-server]$ telnet pg1-server 8432
Trying 172.XX.XXX.XXX...
Connected to pg1-server.
Escape character is '^]'.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 使用TLS 1.2时发生Python SSL错误 - Python SSL error when using TLS 1.2 laravel 在使用 tls 和我自己的 postfix/virtualmin 服务器发送电子邮件时显示错误 - laravel shows error when sending email using tls and my own postfix/virtualmin server 使用 SSL/TLS 时出现 WCF 错误 - WCF error when using SSL / TLS 卷曲错误:没有到主机的路由 - Curl error : No route to host Hyperledger Fabric 错误:安装链代码时出现“TLS:错误的证书服务器” - Hyperledger Fabric error: "TLS: bad certificate server" when installing chaincode 使用椭圆曲线密钥创建服务器和客户端时,使用Node JS TLS密码和密码选项(无共享密码套件错误) - Using Node JS TLS passphrase and cipher options when creating a server and client using elliptic curve keys (no shared cipher suites error) 上传到TLS环境时,使用Cordova的FileTransfer API时出错 - Error Using Cordova's FileTransfer API, When Uploading to a TLS Environment FileZilla 服务器上基于 SSL/TLS 的 FtpWebRequest 启用了“使用 PROT P 时需要 TLS session 恢复数据连接” - FtpWebRequest over SSL/TLS on a FileZilla Server with “Require TLS session resumption on data connection when using PROT P” enabled 在 Android Studio 的主机上运行时需要 GRPC.network 调用的 TLS - Need TLS for GRPC network calls when running on host in Android Studio 服务器问候完成后的 TLS 握手错误 - TLS Handshake error after server hello Done
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM