HAProxy, PGSQL with SSL and multiple clusters under one port
HAProxy, PGSQL with SSL and multiple clusters under single port
在我的用例中,我使用 SSL 连接到 PG 节点,因为我不想使用 SSL 终止,所以我只能使用 TCP 模式。
使用 TCP 模式,我无法访问 header 信息,尤其是主机。因此我不能使用像
这样的东西
# 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 或 stage 集群的主节点,具体取决于主机名。
是否有其他替代方案,我可以避免为每个集群使用新端口?
在我的用例中,我使用 SSL 连接到 PG 节点,因为我不想使用 SSL 终止,所以我只能使用 TCP 模式。
使用 TCP 模式,我无法访问 header 信息,尤其是主机。因此我不能使用像
这样的东西# 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 或 stage 集群的主节点,具体取决于主机名。
是否有其他替代方案,我可以避免为每个集群使用新端口?