第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定

基于Nginx&Lua 和Netflix Eureka的微服務(wù)網(wǎng)關(guān)

標(biāo)簽:
Nginx

依赖:lua-resty-http
基于Nginx&Lua 和Netflix Eureka的微服务网关。

重新架构了内部组件,采用插件模式。

  • 服务发现

    • Eureka Discovery

    • 抽象discovery,用来支持多种服务发现?规划中...

  • 动态路由

  • 负载均衡

    • 加权轮询

    • 基于响应时间的动态权重轮询?开发中...

  • 简单监控

  • 隔离降级

  • 限流

  • metrics

  • 认证安全?规划中。。。

  • 监控页面?开发中...

架构图:

使用方法

基于Nginx和Lua module。需要安装Nginx Lua环境或者直接下载openresty编译安装。

安装和配置ngx-lua-zuul

下载代码到/path/to/nginx/lua/lib/

git clone http://github.com/tietang/ngx-lua-zuul --depth=1

例子Eureka 服务

如果没有Eureka环境,也可以编译安装本例子中的EurekaDemo服务

部署dicovery例子服务:

下载代码后:

cd /path/to/ngx_lua-zuul/demo/java
mvn clean install

将下载的代码中的lua文件夹放到部署目录/path/to/nginx,修改/path/to/nginx/lua/ngx_conf/lua.ngx_conf文件中的lua_package_path为你的真实路径:
lua_package_path "/path/to/nginx/lua/lib/?.lua;;";

修改/path/to/nginx/conf/nginx.conf文件

http 节点中添加

include "/path/to/lua/ngx_conf/ngx_inlude_http.conf";

server节点中添加

include "/path/to/nginx/lua/ngx_conf/ngx_inlude_server.conf";

参考配置

 #user  nobody;worker_processes  2;#error_log  logs/error.log;#error_log  logs/error.log  notice;#error_log  logs/error.log  info;#pid        logs/nginx.pid;events {
    worker_connections  1024;
}


http {    include       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  logs/access.log  main;

    sendfile        on;    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;    #gzip  on;
    include "/Users/tietang/nginx/nginx/lua/ngx_conf/ngx_inlude_http.conf";


    server {        include "/Users/tietang/nginx/nginx/lua/ngx_conf/ngx_inlude_server.conf";        #error_page  404              /404.html;

        # redirect server error pages to the static page /50x.html
        #

        location = / {
            set $dir $document_root;
            root   $dir/html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }

        
    }


   

}

运行测试

启动所有的demo服务:discovery,api,zuul;

启动nginx;



作者:铁汤
链接:https://www.jianshu.com/p/cf5ed38a6fc3


點擊查看更多內(nèi)容
TA 點贊

若覺得本文不錯,就分享一下吧!

評論

作者其他優(yōu)質(zhì)文章

正在加載中
  • 推薦
  • 評論
  • 收藏
  • 共同學(xué)習(xí),寫下你的評論
感謝您的支持,我會繼續(xù)努力的~
掃碼打賞,你說多少就多少
贊賞金額會直接到老師賬戶
支付方式
打開微信掃一掃,即可進行掃碼打賞哦
今天注冊有機會得

100積分直接送

付費專欄免費學(xué)

大額優(yōu)惠券免費領(lǐng)

立即參與 放棄機會
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號

舉報

0/150
提交
取消