少年阿宾

那些青春的岁月

  BlogJava :: 首页 :: 联系 :: 聚合  :: 管理
  500 Posts :: 0 Stories :: 135 Comments :: 0 Trackbacks
Haproxy根目录:F:\SysWork\openSource\haproxy\haproxy1.5.12

配置文件haproxy.cfg如下:


global  
        log 127.0.0.1   local0
#        maxconn 4096
        chroot F:\SysWork\openSource\haproxy\haproxy1.5.12
#        uid 99
#        gid 99
#        daemon
        nbproc 1
        pidfile F:\SysWork\openSource\haproxy\haproxy1.5.12\haproxy.pid         
        debug quiet
defaults  
        log     127.0.0.1       local3
        mode    http
        option httplog
        option httpclose
        option dontlognull
        option forwardfor
        option redispatch
        retries 3
        maxconn 8192
        balance roundrobin
        timeout connect 50000
timeout client  50000
timeout server  50000
        timeout check   20000
listen httpweb :8100  
       mode http  
       balance roundrobin  
       option httpclose  
       option forwardfor  
       option httpchk GET /index.html #心跳检测的文件  
       server httpweb1 localhost:9200 cookie 1 weight 5 check inter 2000 rise 2 fall 3
       server httpweb2 localhost:9300 cookie 2 weight 3 check inter 2000 rise 2 fall 3
  
listen httpservice :8200  
       mode http  
       balance roundrobin  
       option httpclose  
       option forwardfor  
       option httpchk GET /index.html #心跳检测的文件  
       server httpservice1 localhost:9200 cookie 3 weight 5 check inter 2000 rise 2 fall 3
       server httpservice2 localhost:9300 cookie 4 weight 3 check inter 2000 rise 2 fall 3
listen tcpservice        
bind 0.0.0.0:8400        
mode tcp             
server tcpservice1 localhost:20880 cookie 5 weight 3 check inter 2000 rise 2 fall 3
  
listen status 127.0.0.1:8300
    stats enable
    stats uri /status
    stats auth admin:123456
    stats realm (Haproxy\ statistic) 


启动命令:
F:\SysWork\openSource\haproxy\haproxy1.5.12>haproxy.exe -f haproxy.cfg
[WARNING] 240/200829 (11260) : parsing [haproxy.cfg:14] : 'option httplog' not usable with proxy 'tcpservice' (needs 'mo
de http'). Falling back to 'option tcplog'.
[WARNING] 240/200829 (11260) : config : 'option forwardfor' ignored for proxy 'tcpservice' as it requires HTTP mode.
[WARNING] 240/200829 (11260) : config : proxy 'tcpservice' : ignoring cookie for server 'tcpservice1' as HTTP mode is di
sabled.
Available polling systems :
       poll : pref=200,  test result OK
     select : pref=150,  test result FAILED
Total: 2 (1 usable), will use poll.
Using poll() as the polling mechanism.
[WARNING] 240/200829 (11260) : [haproxy.main()] Cannot raise FD limit to 4019.
[WARNING] 240/200829 (11260) : [haproxy.main()] FD limit (256) too low for maxconn=2000/maxsock=4019. Please raise 'ulim
it-n' to 4019 or more to avoid any trouble.
[WARNING] 240/200830 (11260) : Server httpweb/httpweb1 is DOWN, reason: Layer4 connection problem, info: "Connection ref
used", check duration: 1000ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[WARNING] 240/200831 (11260) : Server httpweb/httpweb2 is DOWN, reason: Layer4 connection problem, info: "Connection ref
used", check duration: 1000ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
[ALERT] 240/200831 (11260) : proxy 'httpweb' has no server available!
[WARNING] 240/200831 (11260) : Server httpservice/httpservice1 is DOWN, reason: Layer4 connection problem, info: "Connec
tion refused", check duration: 1000ms. 1 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in
 queue.
[WARNING] 240/200831 (11260) : Server httpservice/httpservice2 is DOWN, reason: Layer4 connection problem, info: "Connec
tion refused", check duration: 998ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in
queue.
[ALERT] 240/200831 (11260) : proxy 'httpservice' has no server available!



监控页面地址:http://127.0.0.1:8300/status



现在配置文件除了http代理之外,还有tcp代理,http代理就是简单的代理tomcat的请求。把haproxy的请求分发给多个tomcat,而tcp代理我这里是代理的dubbo请求,dubbo启动起来的时候20880端口,但是我们可以通过这里的8400端口提供请求
我们之前都是通过telnet localhost 20880可以看到dubbo控制台,现在可以通过telnet localhost 8400查看dubbo控制台
posted on 2015-08-29 20:09 abin 阅读(4253) 评论(0)  编辑  收藏

只有注册用户登录后才能发表评论。


网站导航: