免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 5822 | 回复: 5
打印 上一主题 下一主题

负载均衡如何测试? [复制链接]

论坛徽章:
5
技术图书徽章
日期:2013-08-27 10:03:49CU大牛徽章
日期:2013-09-18 15:16:55CU大牛徽章
日期:2013-09-18 15:18:22CU大牛徽章
日期:2013-09-18 15:18:43技术图书徽章
日期:2014-04-24 15:51:26
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2012-04-28 21:09 |只看该作者 |倒序浏览
如题!

偶搜了一些帖子,只是简单的不断刷新页面而已。

我配的nginx,后端是apache

用ab测试,结果全部集中访问到了一台机器上了,手动刷新也无济。

这其中有什么诀窍吗?

论坛徽章:
0
2 [报告]
发表于 2012-04-29 08:04 |只看该作者
虽然我长的不是很帅,但小时候也有人夸我左边鼻孔很偶像派。

你加油吧

论坛徽章:
0
3 [报告]
发表于 2012-05-06 01:30 |只看该作者
配置文件贴上来nginx

论坛徽章:
0
4 [报告]
发表于 2012-05-07 15:17 |只看该作者
nginx默认是1:1进行均衡的,至于为何没均衡,要看看配置文件

论坛徽章:
5
技术图书徽章
日期:2013-08-27 10:03:49CU大牛徽章
日期:2013-09-18 15:16:55CU大牛徽章
日期:2013-09-18 15:18:22CU大牛徽章
日期:2013-09-18 15:18:43技术图书徽章
日期:2014-04-24 15:51:26
5 [报告]
发表于 2012-05-07 21:54 |只看该作者
回复 4# 南非蚂蚁

见笑了,我的是测试环境

    [root@centos ~]# cat /etc/nginx/nginx.conf

user  nginx;
worker_processes  2;  
worker_rlimit nofile 5120;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    use epoll;
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

   # log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
   #                  '$status $body_bytes_sent "$http_referer" '
   #                  '"$http_user_agent" "$http_x_forwarded_for"';

   # access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;
    server_tokens   off;

    server_names_hash_bucket_size        256;
    client_header_buffer_size                256k;
    large_client_header_buffers                4        256k;
    client_max_body_size                50m;
    client_body_buffer_size                256k;

    keepalive_timeout  65;

    gzip  on;
    gzip_static        on;
    gzip_comp_level 5;
    gzip_min_length 1024;
    gzip_types       text/plain application/x-javascript text/css application/xml;


    proxy_hide_header                Vary;
    proxy_connect_timeout        600;
    proxy_read_timeout                600;
    proxy_send_timeout                600;
    proxy_buffer_size                16k;
    proxy_buffers                4 64k;
    proxy_busy_buffers_size        128k;
    proxy_temp_file_write_size        128k;

    include /etc/nginx/conf.d/*.conf;
}

[root@centos ~]# cat /etc/nginx/conf.d/default.conf
upstream test.org {
        ip_hash;        
        server   192.168.122.10:80;
        server   192.168.122.20:80;
        server   192.168.122.30:80;
}

server {
    listen       80;
    server_name  test.org alias www.test.org;

    #charset koi8-r;
    #access_log  /var/log/nginx/log/host.access.log  main;

    location / {
        #root        /var/www/html;
        index        index.html index.php index.htm ;
        proxy_redirect                off;
        proxy_pass                        http://test.org;
        proxy_set_header                host         $host;
        proxy_next_upstream error        timeout invalid_header http_500 http_502 http_504;
        proxy_set_header                X-Real_IP        $remote_addr;
        proxy_set_header                X-Forwarded-For                $remote_addr;
    }

    location /NginxStatus {
        stub_status    on;
        access_log   on;
        allow 192.168.122.0/24;                
    }
}

             log_format  test.org  '$remote_addr - $remote_user [$time_local] $upstream_addr $upstream_status $request'
                '"$status"        $body_bytes_sent "$http_referer"'
                '"$http_user_agent"        "$http_x_forwarded_for"';
                access_log        /var/log/nginx/test.org_access.log  test.org;

论坛徽章:
5
技术图书徽章
日期:2013-08-27 10:03:49CU大牛徽章
日期:2013-09-18 15:16:55CU大牛徽章
日期:2013-09-18 15:18:22CU大牛徽章
日期:2013-09-18 15:18:43技术图书徽章
日期:2014-04-24 15:51:26
6 [报告]
发表于 2012-05-07 23:30 |只看该作者
已解决,问题出在ip_hash上,去掉就好了,谢谢!
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP