我在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
任何建议?
答案 0 :(得分:0)
要在浏览器上查看HAProxy统计信息,请将这些行放在配置文件中。
您将能够在http://Hostname:9000
listen stats :9000
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
答案 1 :(得分: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`