Kohei TANUMA
tanum****@nttco*****
2010年 7月 20日 (火) 11:15:15 JST
Hi, 2010/07/20 5:20, Chen, Jiahui wrote: > When I use the url module pattern match, it seems only works for the > first avalable pattern. For example, I set a pattern 'pattern1' to > forward url to server 1 first and then 'pattern2' to forward url to > server 2. Only the pattern 1 work ( the url can be forward to server 1 > but can not to server 2 ). When I change the order, set 'pattern2' first > and then 'pattern1', it only works for pattern2. If I set these two > pattern to different ports, both work. Thus I want to know is there only > 1 module works for 1 port? If not, how to set multiple modules on 1 port? It is possible. Create the virtual server as follows. # l7vsadm -A -t 0:80 -m url --pattern-match 'pattern1' # l7vsadm -a -t 0:80 -m url --pattern-match 'pattern1' -r server1:80 # l7vsadm -A -t 0:80 -m url --pattern-match 'pattern2' # l7vsadm -a -t 0:80 -m url --pattern-match 'pattern2' -r server2:80 Now, 1 port(HTTP port) has 2 url modules. # l7vsadm -K Layer-7 Virtual Server version 2.1.3-1 Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string -> RemoteAddress:Port Forward Weight ActiveConn InactConn TCP 0.0.0.0:http url rr 0 --pattern-match pattern1 -> server1:http Masq 1 0 0 TCP 0.0.0.0:http url rr 0 --pattern-match pattern2 -> server2:http Masq 1 0 0 And then, send 'pattern1' request. This request will be send to server1. # links -dump http://localhost/pattern1.html server1 sample content Check the balancing status. server1's InactConn should be increased. # l7vsadm -K Layer-7 Virtual Server version 2.1.3-1 Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string -> RemoteAddress:Port Forward Weight ActiveConn InactConn TCP 0.0.0.0:http url rr 0 --pattern-match pattern1 -> server1:http Masq 1 0 *1* TCP 0.0.0.0:http url rr 0 --pattern-match pattern2 -> server2:http Masq 1 0 0 Next, send 'pattern2' request. This request will be send to server2. # links -dump http://localhost/pattern2.html server2 sample content Check the balancing status again. server2's InactConn should be increased this time. # l7vsadm -K Layer-7 Virtual Server version 2.1.3-1 Prot LocalAddress:Port ProtoMod Scheduler Reschedule Protomod_key_string -> RemoteAddress:Port Forward Weight ActiveConn InactConn TCP 0.0.0.0:http url rr 0 --pattern-match pattern1 -> server1:http Masq 1 0 1 TCP 0.0.0.0:http url rr 0 --pattern-match pattern2 -> server2:http Masq 1 0 *1* Thanks, Kohei