haproxy

global
log 127.0.0.1 local0
#log 127.0.0.1 local1 notice
#log loghost local0 info
maxconn 1500
chroot H:\TDownload\haproxy\haproxy
uid haproxy
gid haproxy
daemon
nbproc 2
pidfile H:\TDownload\haproxy\haproxy\haproxy.pid
#debug
#quiet

defaults
log 127.0.0.1 local3
mode http
option httplog
option httpclose
option dontlognull
option forwardfor
option redispatch
retries 2
maxconn 2000
balance roundrobin
stats enable
stats uri /haproxy-stats #haproxy运行状态查看 自定义uri
contimeout 5000
clitimeout 50000
srvtimeout 50000

listen web_proxy 192.168.1.125:2080 #监听端口
option httpchk HEAD /System HTTP/1.0 #健康检测 检测server web根目录有无此文件
server s1 192.168.1.253:8090 weight 3 check
server s2 192.168.1.253:9080 weight 3 check
#server s3 211.157.100.88:80 weight 3 check

要修改 haproxy.cfg  增加配置项

  listen tcp_haproxy 192.168.154.11:11001
          mode tcp
          balance roundrobin
          server t1 192.168.154.12:11001

这个表示 通过 11001 转发 到 12服务器的11001 端口上,用tcp协议。
通讯的 就要 用这个方式。

 

 listen  web_proxy 192.168.1.125:2080   #监听端口         
         option httpchk HEAD /System HTTP/1.0   #健康检测 检测server web根目录有无此文件
        server s1 192.168.1.253:8090 weight 3 check  
        server s2 192.168.1.253:9080 weight 3 check  

这种是 监听 http的,像平台转发和 门禁接口转发 用这种方式。

 

改玩之后, 先运行stop.bat,在运行run.bat

我给你发的是参考格式,你复制的时候ip要改成 实际的。

 

posted @ 2019-07-31 12:05  小丸子的西瓜梦  阅读(274)  评论(0编辑  收藏  举报