zoukankan      html  css  js  c++  java
  • nginx做负载均衡和*

    nginx做负载均衡。

    我们了解负载均衡的实现,一般有3种形式。第一种,默认方式是1:1轮巡,第二种,权重,第三种,哈希。

    实验的图如下:

    当然是首先要配置好系统和4个LNMP结构。我们这里着重直说Nginx里面负载均衡的配置。

    worker_processes  1;
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        error_log logs/error.log error;
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
        sendfile        on;
        keepalive_timeout  65;
        #nginx vhosts config
        include extra/www.conf;
        include extra/bbs.conf;
        include extra/blog.conf;
        include extra/status.conf;
    }

    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

    这个是负载均衡器上的

    worker_processes  1;
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile on;
        keepalive_timeout 65;
        error_log logs/error.log error;
        log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                          '$status $body_bytes_sent "$http_referer" '
                          '"$http_user_agent" "$http_x_forwarded_for"';
    upstream bbs_server_pools{
        server 192.168.3.103 weight=3;
    
        server 192.168.3.104 weight=2;
    }
        #nginx vhosts config
         include extra/lb_bbs.conf;
      }

     

  • 相关阅读:
    异步任务----django-celery
    signal函数
    shell脚本字符显示颜色
    echo输出到文件
    windows下opencv安装
    模板
    下载vs地址
    关联容器 map
    构造函数初始化列表
    assert() fflush()
  • 原文地址:https://www.cnblogs.com/davidz/p/14899921.html
Copyright © 2011-2022 走看看