Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Postgresql HAProxy、带SSL的PGSQL和单端口下的多个集群_Postgresql_Haproxy - Fatal编程技术网

Postgresql HAProxy、带SSL的PGSQL和单端口下的多个集群

Postgresql HAProxy、带SSL的PGSQL和单端口下的多个集群,postgresql,haproxy,Postgresql,Haproxy,在我的用例中,我使用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_bac

在我的用例中,我使用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或stage cluster的主节点


是否有其他方法可以避免为每个集群使用新端口?

我认为您可能需要一个类似或的协议感知代理

在这两者中,我认为pgbouncer在意图和用法上更接近haproxy