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/
    
    

    。。。。。。未完待续

  • 相关阅读:
    nginx1.9+新增tcp/udp代理stream
    mysql授权
    搭建GIT服务器
    Centos调出图形化的网络管理
    吾爱破解论坛纪念壁纸(怀念)
    VNC-tigervnc-server远程调用图形化
    Linux生成高强度密码
    Linux学习必备
    git编译
    书单
  • 原文地址:https://www.cnblogs.com/zhenxing06/p/13595959.html
Copyright © 2011-2022 走看看