我的 haproxy.cfg 是这个
frontend go 127.0.0.1:8081
timeout client 86400000
acl ddos_log path_beg /ddoslogger/
use_backend ddos_backend if ddos_log
use_backend normal_backend if !ddos_log
backend ddos_backend
mode http
option httplog
balance uri
# Will add more servers if this works
server go11 localhost:8083 check
server go11 localhost:8083 backup
backend normal_backend
mode http
option httplog
option allbackups
default-server weight 50 slowstart 30s inter 3s fastinter 2s downinter 5s
server go10 localhost:8082 check
server go10 localhost:8082 backup
我计划做的基本上是对“/ddoslogger/”的所有查询,我将使用 balance uri 方法来选择服务器,而对于其他人使用不同的负载平衡方法。两者都与同一组服务器通信(出于调试目的,我删除了其他服务器)
这是我在调试模式下向 haproxy 发出请求时得到的结果
00000000:go.accept(0004)=0006 from [127.0.0.1:58054]
00000000:normal_backend.clireq[0006:ffff]: POST /ddoslogger/a01324jlkas HTTP/1.1
00000000:normal_backend.clihdr[0006:ffff]: Host: localhost:8081
00000000:normal_backend.clihdr[0006:ffff]: Connection: keep-alive
00000000:normal_backend.clihdr[0006:ffff]: Content-Length: 204
00000000:normal_backend.clihdr[0006:ffff]: Cache-Control: no-cache
00000000:normal_backend.clihdr[0006:ffff]: Origin: chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm
00000000:normal_backend.clihdr[0006:ffff]: User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36
00000000:normal_backend.clihdr[0006:ffff]: Content-Type: application/x-www-form-urlencoded
00000000:normal_backend.clihdr[0006:ffff]: Accept: */*
00000000:normal_backend.clihdr[0006:ffff]: Accept-Encoding: gzip,deflate,sdch
00000000:normal_backend.clihdr[0006:ffff]: Accept-Language: en-US,en;q=0.8
00000000:normal_backend.clihdr[0006:ffff]: Cookie: <truncated>
00000000:normal_backend.srvrep[0006:0007]: HTTP/1.1 200 OK
00000000:normal_backend.srvhdr[0006:0007]: Content-Type: text/plain; charset=utf-8
00000000:normal_backend.srvhdr[0006:0007]: Content-Length: 0
00000000:normal_backend.srvhdr[0006:0007]: Date: Thu, 19 Sep 2013 03:55:19 GMT
关于我做错了什么的任何建议?