zoukankan      html  css  js  c++  java
  • nginx动态增删upstream

    server:192.168.159.128

    node-1:192.168.159.130

    node-2:192.168.159.133

    1.安装依赖包

    yum install wget git openssl openssl-devel gcc pcre pcre-devel jemalloc jemalloc-devel

    2.下载安装包

    wget http://tengine.taobao.org/download/tengine-2.3.2.tar.gz
    git clone git://github.com/vozlt/nginx-module-vts.git
    3.安装
      mkdir /software/servers/nginx/
      tar xf tengine-2.3.2.tar.gz -C /software/servers/
      cd /software/servers/tengine-2.3.2
      编译安装nginx:
      ./configure  --prefix=/software/servers/nginx --add-module=./modules/ngx_http_upstream_dyups_module --with-http_v2_module --with-jemalloc --with-http_ssl_module --with-http_v2_module --with-http_stub_status_module --add-module=./modules/ngx_http_upstream_vnswrr_module --add-module=./modules/nginx-module-vts/
      make && make install
      mkdir /software/servers/nginx/conf/vhost
    4.修改配置
      vim /software/servers/nginx/conf/nginx.conf
      
    http {
        include       mime.types;
        default_type  application/octet-stream;
    
        #access_log  "pipe:rollback logs/access_log interval=1d baknum=7 maxsize=2G"  main;
    
        sendfile        on;
    
        keepalive_timeout  65;
        vhost_traffic_status_zone;
        include vhost/upstream.conf;加载初始持久配置
        server {
            listen       80;
            server_name  localhost;
    
            #charset koi8-r;
    
            #access_log  logs/host.access.log  main;
            #access_log  "pipe:rollback logs/host.access_log interval=1d baknum=7 maxsize=2G"  main;
    
            location / {
             set $web "t1"; 
             proxy_set_header Host $host;
             proxy_pass http://$web;
            }
    
            #error_page  404              /404.html;
    
            # redirect server error pages to the static page /50x.html
            #
            error_page   500 502 503 504  /50x.html;
            location = /50x.html {
                root   html;
            }
    
        }
    
          server {
            listen 8081;
            location / {
                dyups_interface;
                access_log   logs/dumps.log;
                allow 127.0.0.1;
                deny all;
            }
        }
    
    }
      vim /software/servers/nginx/conf/vhost/upstream.conf
      upstream t1{
        server 192.168.159.130:80;
      }
      
    动态添加
    curl -d "server 192.168.159.130:80;server 192.168.159.133:80;" 127.0.0.1:8081/upstream/t1
     
    动态删除
    curl -i -X DELETE 127.0.0.1:8081/upstream/t1
     
  • 相关阅读:
    windows10使用arcgis注意事项
    andriod arcgis加载影像TIF
    FeatureTable()
    arcgis Listview
    ArcGIS for Android图层记录数,图层选择记录,图层字段数
    ArcGIS for Android 点击选择
    ArcGIS for Android地图上实际距离与对应的屏幕像素值计算
    Android如何检查对象的类型
    北美内地电影票房总排行榜
    XSS漏洞的渗透利用另类玩法
  • 原文地址:https://www.cnblogs.com/thanos-ryan/p/14440195.html
Copyright © 2011-2022 走看看