具有公共IP地址的HAProxy

问题描述 投票:0回答:2

我在另一个Internet数据中心中有很多服务器。我可以使用haproxy负载均衡其中的每个网站。仅使用私有IP遵循后端中的文档,如何使用公共IP,如下所示。如果没有任何应用程序可以做到这一点?谢谢。

这些是我的设置:haproxy.cfg

global
    daemon
    maxconn 256
    user        haproxy
    group       haproxy
    chroot      /var/lib/haproxy

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend http
    bind *:80
    default_backend servers

backend servers
    server server public ip?
    server server public ip?
    server server public ip?
nginx centos haproxy
2个回答
0
投票

服务器的IP地址可以是可以从代理访问的任何IP。通常,它是与服务器位于同一网络上的专用地址,但不必一定是-世界另一端的服务器的公用地址也可以使用。


0
投票

您可以这样做:

global
    daemon
    maxconn 256
    user        haproxy
    group       haproxy
    chroot      /var/lib/haproxy

defaults
    mode http
    timeout connect 5000ms
    timeout client 50000ms
    timeout server 50000ms

frontend http
    bind *:80
    default_backend servers

backend servers
    balance roundrobin
    mode http
    option forwardfor
    option httpchk GET /
    server server1 public.com check
    server server2 123.123.123.123 check
    server server3 public.com check

HAProxy支持IP和DNS

© www.soinside.com 2019 - 2024. All rights reserved.