zoukankan      html  css  js  c++  java
  • Nginx Consul nginx-upsync-module

    nginx consul nginx-upsync-module

    依赖包:

    yum -y install libpcre3 libpcre3-dev ruby zlib1g-dev patch
    

    下载nginx 包和nginx-upsync-module 模块:

    cd /data/src/
    wget https://nginx.org/download/nginx-1.10.1.tar.gz
    https://codeload.github.com/weibocom/nginx-upsync-module/tar.gz/v2.1.2
    
    

    编译安装nginx:

    tar -zxvf nginx-1.10.1.tar.gz  && cd nginx-1.10.1/
    ./configure --user=work --group=work --prefix=/data/work/nginx --with-http_ssl_module --add-module=/data/src/nginx-upsync-module-2.1.2
    make && make install 
    
    

    nginx 配置:

    ......
    upstream upload_server {
           server 127.0.0.1:8081 down;
           upsync  10.20.0.125:8500/v1/kv/upstreams/upload_server upsync_timeout=6m upsync_interval=500ms upsync_type=consul strong_dependency=off;
           upsync_dump_path /data/work/nginx/conf/vhost/upload_server.conf;
     
           include /data/work/nginx/conf/vhost/upload_server.conf;
       }   
    ......
    

    向consul插入数据:

    curl -X PUT http://10.20.0.125:8500/v1/kv/upstreams/upload_server/bj-upload1:8080
    curl -X PUT http://10.20.0.125:8500/v1/kv/upstreams/upload_server/bj-upload2:8080
    

    访问查看结果:

    http://$consulip:8500/ui/dc1/kv/upstreams/
    
    

    。。。。。。未完待续

  • 相关阅读:
    性能百万/s:腾讯轻量级全局流控方案详解
    Swagger2
    shiro 入门
    01、单例模式
    02、工厂方法
    04、模板模式
    13、Adapter 适配器
    14、迭代器
    Java 面向切面 AOP
    spring boot 中使用 Redis 与 Log
  • 原文地址:https://www.cnblogs.com/zhenxing06/p/13595959.html
Copyright © 2011-2022 走看看