qiyubin 发表于 2012-2-19 13:14:15

为什么我loadrunner ip spoofer 的nginx iphash始终在使用同一服务在处理请求呢?

附图跟 nginx 配置 upstream mysvr {
          #开启粘滞会话
          ip_hash;
      #weigth参数表示权值,权值越高被分配到的几率越大
          server 172.16.17.120:8080;
          server 172.16.17.120:10002;
          server 172.16.17.89:8080;
          #server 172.16.17.89:10002 weight=5;
          #server 172.16.17.89:8080 weight=5;
    }
    server {               
      listen 80;
      server_name 172.16.17.120 localhost;
                charset utf-8;
                #对 "/" 启用负载均衡
       location / {
         proxy_pass http://mysvr/;
         proxy_redirect off;
         proxy_set_header Host $host;
         proxy_set_header X-Real-IP $remote_addr;
         proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
         client_max_body_size    10m;
         client_body_buffer_size 128k;
         proxy_connect_timeout 90;
         proxy_send_timeout      90;
         proxy_read_timeout      90;
         proxy_buffer_size      4k;
         proxy_buffers          4 32k;
         proxy_busy_buffers_size 64k;
         proxy_temp_file_write_size 64k;
                }
                location /NginxStatus {
                       stub_status on;
                       access_log on;
                       auth_basic "NginxStatus";
                }
        }2012-02-19 12:57:23,199 INFO - check user is login!----request ip:172.16.17.89
2012-02-19 12:57:23,217 INFO - Executed action [//pub/tvhome!goTV!action!200] took 17 ms (execution: 14 ms, result: 3 ms)
2012-02-19 12:57:23,243 INFO - check user is login!----request ip:172.16.17.89
2012-02-19 12:57:23,258 INFO - Executed action [//pub/tvhome!goTV!action!200] took 14 ms (execution: 12 ms, result: 2 ms)
2012-02-19 12:57:23,286 INFO - check user is login!----request ip:172.16.17.89
2012-02-19 12:57:23,303 INFO - Executed action [//pub/tvhome!goTV!action!200] took 16 ms (execution: 14 ms, result: 2 ms)
2012-02-19 12:57:23,349 INFO - check user is login!----request ip:172.16.17.89
2012-02-19 12:57:23,365 INFO - Executed action [//pub/tvhome!goTV!action!200] took 15 ms (execution: 13 ms, result: 2 ms)
?????? DaemonCollege time=2012-02-19 13:00:00
^C
root@ubuntu:~# tail -f /opt/tomcat/apache-tomcat-6.0.35/logs/catalina.out
2012-02-19 13:05:02,302 INFO - Executed action [//pub/index!index!action!200] took 1 ms (execution: 0 ms, result: 1 ms)
2012-02-19 13:05:02,304 INFO - Executed action [//pub/tvhome!goTV!action!200] took 18 ms (execution: 17 ms, result: 1 ms)
2012-02-19 13:05:02,357 INFO - check user is login!----request ip:172.16.17.240
2012-02-19 13:05:02,359 INFO - check user is login!----request ip:172.16.17.240
2012-02-19 13:05:02,664 INFO - check user is login!----request ip:172.16.17.240
2012-02-19 13:05:02,669 INFO - Executed action [//pub/tvhome!goTV!action!200] took 308 ms (execution: 8 ms, result: 300 ms)
2012-02-19 13:05:02,673 INFO - Executed action [//pub/index!index!action!200] took 2 ms (execution: 1 ms, result: 1 ms)
2012-02-19 13:05:02,675 INFO - Executed action [//pub/tvhome!goTV!action!200] took 316 ms (execution: 11 ms, result: 305 ms)
2012-02-19 13:05:02,721 INFO - check user is login!----request ip:172.16.17.240
2012-02-19 13:05:02,731 INFO - Executed action [//pub/tvhome!goTV!action!200] took 9 ms (execution: 7 ms, result: 2 ms)

qiyubin 发表于 2012-2-19 13:15:42

我一共模拟了5个IP 结果全部都访问8080 tomcat服务 我在服务器上安装了2个tomcat服务

qiyubin 发表于 2012-2-19 14:48:23

结贴!
漆羽斌:
      nginx负载均衡最小单位是C类网关 ,我模拟了2个比c类大的IP成功了。。。

xueying1123 发表于 2012-9-17 18:25:23

{:4_86:}楼主怎么设置的,我模拟了1个A类、1个B类、1个C类,三个ip地址对nginx的iphash负载均衡做压力,怎么压力还是全在同一个应用服务器上?
还能把楼主召唤出来不 - -

xueying1123 发表于 2012-9-17 18:28:10

我模拟了三个Ip地址分别是A类B类C类,对nginx的iphash负载均衡做压力测试,为什么压力全在一台应用服务器上。
还能把楼主召唤出来不 - -

xueying1123 发表于 2012-9-19 10:49:35

别人有解决办法吗

xueying1123 发表于 2012-9-19 11:24:57

可以了{:4_87:}
页: [1]
查看完整版本: 为什么我loadrunner ip spoofer 的nginx iphash始终在使用同一服务在处理请求呢?