Chinaunix首页 | 论坛 | 博客
  • 博客访问: 26314926
  • 博文数量: 2065
  • 博客积分: 10377
  • 博客等级: 上将
  • 技术积分: 21525
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-04 17:50
文章分类

全部博文(2065)

文章存档

2012年(2)

2011年(19)

2010年(1160)

2009年(969)

2008年(153)

分类: 系统运维

2010-08-19 22:54:07

haproxy 1.3.4 今天发布了,最大的改变是"Content-Switching"。frontend根据任意HTTP请求头内容做规则匹配,然后把请求定向到相关的backend;frontend和backend是1.3.4引入的新概念。加了这个功能的Haproxy,和硬件的Level 4 Switch功能上基本差不多了,赞!(硬件四层交换效率肯定要高的!)

举例:
frontend public #frontend,等于以前的listen main 192.168.1.10:80
bind 192.168.1.10:80
mode http
log global
option httplog
option dontlognull
option httpclose
monitor-uri /monitoruri
maxconn 8000
clitimeout 30000

# Host: will use a specific keyword soon
reqisetbe ^Host:\ img static #类似打补丁scaner后的reqigo

# The URI will use a specific keyword soon
reqisetbe ^[^\ ]*\ /(img|css)/ static
reqisetbe ^[^\ ]*\ /admin/stats stats

default_backend dynamic



# The static backend backend for 'Host: img', /img and /css.
backend static
mode http
balance roundrobin
contimeout 5000
srvtimeout 5000
redispatch
retries 2
option httpchk HEAD /favicon.ico
server statsrv1 192.168.1.8:80 check inter 1000
server statsrv2 192.168.1.9:80 check inter 1000

backend dynamic
mode http
balance roundrobin
contimeout 30000
srvtimeout 30000
redispatch
retries 2
option httpchk HEAD /login.php
cookie DYNSRV insert indirect nocache
fullconn 4000 # the servers will be used at full load above this number of connections
server dynsrv1 192.168.1.1:80 minconn 50 maxconn 500 cookie s1 check inter 1000
server dynsrv2 192.168.1.2:80 minconn 50 maxconn 500 cookie s2 check inter 1000

backend stats
log global
mode http
stats uri /
balance roundrobin
Haproxy处理HTTP请求的流程更清晰了
阅读(1109) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~