0

我在 RedHat 服务器上配置了 HAproxy。服务器已启动并运行,没有任何问题,但我无法通过浏览器访问服务器。我已经为绑定地址打开了防火墙端口。

tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      2080/haproxy 

haproxy.cfg的如下:

defaults
  log global
  mode http
  option httplog
  option dontlognull
  retries 3
  option redispatch
  maxconn 2000
  contimeout 5000
  clitimeout 50000
  srvtimeout 50000

frontend http-in
  bind *:80

  default_backend servers

backend servers
  option httpchk OPTIONS /
  option forwardfor

  stats enable
  stats refresh 10s
  stats hide-version
  stats scope .
  stats uri /admin?stats
  stats realm Haproxy\ Statistics
  stats auth admin:pass

  cookie JSESSIONID prefix

  server adempiere1 192.168.1.216:8085 cookie JSESSIONID_SERVER_1 check inter 5000
  server adempiere2 192.168.1.25:8085 cookie JSESSIONID_SERVER_2 check inter 5000

有什么建议吗?

4

2 回答 2

0
global
   log 127.0.0.1 local0
   log 127.0.0.1 local1 notice
   daemon

log global
   mode http
   option httplog
   option dontlognull
   option forwardfor
   retries 1            #number of times it will try to know if system is up or down
   option redispatch    #if one system is down, it will redispatch to another system which is up.
   maxconn 2000         
   contimeout 5         #you can increase these numbers according to your configuration
   clitimeout 50        #this is set to smaller number just for testing
   srvtimeout 50        #so you can view right away the actual result

listen http-in IP_ADDRESS_OF_LOAD_BALANCER:PORT  #example 192.168.1.1:8080

   mode http
   balance roundrobin
   maxconn 10000

  server adempiere1 192.168.1.216:8085 cookie JSESSIONID_SERVER_1 check inter 5000
  server adempiere2 192.168.1.25:8085 cookie JSESSIONID_SERVER_2 check inter 5000

#
#try access from your browser the ip address with the port mentioned in the listen configuration #above.
#or try this is command line `/terminal: curl http://192.168.1.1:8080`
于 2014-12-02T10:53:56.047 回答
0

要在浏览器上查看 HAProxy 统计信息,请将这些行放入配置文件中。您将能够在以下位置看到 HAProxyhttp://Hostname:9000

listen stats :9000
        mode http
        stats enable
        stats hide-version
        stats realm Haproxy\ Statistics
        stats uri /
于 2013-11-19T06:53:49.153 回答