postgresql - HAProxy, PGSQL with SSL and multiple clusters under single port
问题描述
在我的用例中,我使用 SSL 连接到 PG 节点,因为我不想让 SSL 终止,所以我被锁定使用 TCP 模式。
使用 TCP 模式,我无法访问标头信息,尤其是主机。因此,我不能使用类似的东西
# Primary - RW
frontend PGSQL_primary
bind *:5432
acl host_pglab hdr(host) -i pglab-db.local
acl host_stage hdr(host) -i stage-db.local
use_backend cluster_pglab-primary if host_pglab
use_backend cluster_stage-primary if host_stage
backend cluster_pglab-primary
option httpchk OPTIONS /master
http-check expect status 200
default-server inter 2s fall 2 rise 2 on-marked-down shutdown-sessions
server pglab-db-01 pglab-db-01.local:5432 maxconn 100 check check-ssl verify none port 8008
server pglab-db-02 pglab-db-02.local:5432 maxconn 100 check check-ssl verify none port 8008
backend cluster_stage-primary
option httpchk OPTIONS /master
http-check expect status 200
default-server inter 2s fall 2 rise 2 on-marked-down shutdown-sessions
server pglab-db-01 stage-db-01.local:5432 maxconn 100 check check-ssl verify none port 8008
server pglab-db-02 stage-db-02.local:5432 maxconn 100 check check-ssl verify none port 8008
从客户端连接到端口 5432 并将流量重定向到pglab或阶段集群的主节点,具体取决于主机名。
是否有一些替代方案,我可以避免为每个集群使用新端口?
解决方案
推荐阅读
- ios - 如何在 viewdidload() 中使用回调函数?
- c - 如何更改 Linux 终端中的回显字符
- c# - Moq - 无法从 x 转换为 System.Func
- swift - swift - 从左侧为 SlideIn 和 SlideOut 设置动画
- java - 如何在java中的另一个函数中使用带有参数的函数
- sql - 编写脚本以使用递增变量重复更新查询
- npoco - 使用元组从 NPoco 返回具有 2 个值的单行返回错误
- hive - Hive:将 Cast 与 COALESCE 结合使用并为其设置别名
- php - 如何在 Windows 中升级 PHP 版本?
- c# - 如何在 rd.xml 中为 .Net Native 定义程序集(corert)