一、参考Tengine   http://tengine.taobao.org/document_cn/http_dyups_cn.html

ngx_http_dyups_module

Description

This module can be used to update your upstream-list without reloadding Nginx.

TODO:

It can not work with common `nginx_upstream_check_module`.

Compilation

The module is not compiled into Tengine by default. It can be enabled with '--with-http_dyups_module'
configuration parameter, and enabled lua support with '--with-http_dyups_lua_api'.
But it can not be compiled as a '.so'.

二、配置
在http块中引用如下的配置=>
http {
dyups_upstream_conf upstream/ngconf_dyups.conf;
include upstream/ngconf_dyups.conf; #假如已经include进来的话就不需要include了;eg: include upstream/*.conf;
} cat upstream/ngconf_dyups.conf server {
listen 8866;
location / {
dyups_interface; #you should add the directive dyups_interface into your config file to active this feature
}
}
三、restful interface常用操作。
<1>curl -H "host: dyhost" 127.0.0.1:8866/detail        #获取所有的upstream和他们的后端server
xxx-svr-backend
server 10.103.101.169:8080
server 10.103.104.207:8080 xxx-admin-backend
server 10.103.105.81:9001
server 10.103.105.80:9001 xxx-admin.alta.jyall.me.alta1-hg-xxx-admin
server 10.103.105.81:9001
server 10.103.105.80:9001 xxx.alta.jyall.me.alta1-hg-xxx-proxy
server 10.103.101.169:8080
server 10.103.104.207:8080

<2>curl -H "host: dyhost" 127.0.0.1:8866/list      #获取upstream的名称列表

xxx-svr-backend
xxx-admin-backend
xxx-admin.alta.jyall.me.alta1-hg-xxx-admin
xxx.alta.jyall.me.alta1-hg-xxx-proxy

<3>curl -H "host: dyhost" 127.0.0.1:8866/upstream/xxx-svr-backend        #根据upstream的名字找出它后端的server列表

server 10.103.101.169:8080
server 10.103.104.207:8080

<4>添加或更新一个upstream

curl -d "server 127.0.0.1:8089;server 127.0.0.1:8088;" 127.0.0.1:8866/upstream/arun_test

curl -d "server 127.0.0.1:9000;server 127.0.0.1:8088;" 127.0.0.1:8866/upstream/arun_test

curl -H "host: dyhost" 127.0.0.1:8866/upstream/arun_test

server 127.0.0.1:9000
server 127.0.0.1:8088

<5>curl 127.0.0.1:8866/detail

arun_test
server 127.0.0.1:9000
server 127.0.0.1:8088

<6>curl -i -X DELETE 127.0.0.1:8866/upstream/arun_test    #动态删除upstream

HTTP/1.1 200 OK
Date: Wed, 16 Aug 2017 12:05:58 GMT
Content-Length: 7
Connection: keep-alive success

curl 127.0.0.1:8866/detail再次查看"arun_test"的upstream已经被删除了。

-------------------------------------------------------------------------ngx_http_upstream_check_module--------------------------------------------------------------------------------

四、upstream检查模块。

http://tengine.taobao.org/document_cn/http_upstream_check_cn.html

006_nginx动态upstream和安全检查模块的更多相关文章

  1. Windows应急响应和系统加固(2)——Windows应急响应的命令使用和安全检查分析

    Windows应急响应的命令使用和安全检查分析 1.获取IP地址: ·ipconfig /all,获取Windows主机IP地址信息: ·ipconfig /release,释放网络IP位置: ·ip ...

  2. 7、nginx的upstream及fastcgi模块应用

    ngx_http_proxy_module, ngx_http_upstream_module   ngx_http_proxy_module:实现反向代理及缓存功能 proxy_pass http: ...

  3. DSO动态加载PHP模块到Apache服务器

    PHP在Linux/Unix平台上经常与Apache搭配使用,在安装PHP时,有三种安装方式可供选择:静态模式.动态模式(DSO).CGI二进制模式. 由于易于维护和升级,我强烈建议以DSO方式安装P ...

  4. 动态编译添加php模块

    注意:转载请注明出处:http://www.programfish.com/blog/?p=85 在很多时候我们用linux里搭建web服务器的时候会需要编译安装php套件,而在编译安装后可能又会需要 ...

  5. saltstack主机管理项目:动态调用插件解析-模块解析(五)

    一.动态调用插件解析 1.目录结构 1.base_module代码解析: def syntax_parser(self,section_name,mod_name,mod_data): print(& ...

  6. Angular中懒加载一个模块并动态创建显示该模块下声明的组件

    angular中支持可以通过路由来懒加载某些页面模块已达到减少首屏尺寸, 提高首屏加载速度的目的. 但是这种通过路由的方式有时候是无法满足需求的. 比如, 点击一个按钮后显示一行工具栏, 这个工具栏组 ...

  7. 021_nginx动态upstream检查

    GET: 请求指定的页面信息,并返回实体主体.HEAD: 只请求页面的首部. #参考:http://tengine.taobao.org/document_cn/http_upstream_check ...

  8. Nginx的配置与部署研究,Upstream负载均衡模块

    Nginx 的 HttpUpstreamModule 提供对后端(backend)服务器的简单负载均衡.一个最简单的 upstream 写法如下: upstream backend { server ...

  9. 高性能Web服务器Nginx的配置与部署研究(15)Upstream负载均衡模块

    Nginx 的 HttpUpstreamModule 提供对后端(backend)服务器的简单负载均衡.一个最简单的 upstream 写法如下: server backend1.example.co ...

随机推荐

  1. 1. vim 的安装及配置

    简介 vim是什么 vim是一款功能强大.支持各种插件.配置极为灵活的编辑器,且支持多种主流OS(linux.Unix.mac.windows),可用来各种编程预言的coding和文件编辑,用习惯了v ...

  2. C# String类&Math类&DateTime类

    String类: String a = "abcdefghijklmnopqrstuvwxyz"; int length = a.length;  //获取字符串的长度: a = ...

  3. 我们一起来详细的了解react的语法以及组件的使用方法

    jsx的介绍 React 使用 JSX 来替代常规的 JavaScript. JSX 是一个看起来很像 XML 的 JavaScript 语法扩展. jsx的优点 JSX 执行更快,因为它在编译为 J ...

  4. Codeforces Round #517 (Div. 2, based on Technocup 2019 Elimination Round 2) D. Minimum path

    http://codeforces.com/contest/1072/problem/D bfs 走1步的最佳状态 -> 走2步的最佳状态 -> …… #include <bits/ ...

  5. 解决vue <router-link>在IE与火狐上点击失效(路由不跳转)问题

    <router-link to="/GoAbroad"> </router-link> vue中的<router-link>这种声明式的路由方式 ...

  6. javascript Date定义和体验

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  7. js 定义像java一样的map方便取值【转】

    js 定义像java一样的map方便取值.  百度有位大神说"js对象本身就是一种Map结构",这真是一段让人欢天喜地的代码. <script> //定义一个全局map ...

  8. IdeaVim-常用操作

    IdeaVim简介 IdeaVim是IntelliJ IDEA的一款插件,他提高了我们写代码的速度,对代码的跳转,查找也很友好. 安装位置 安装之后它在 Tools > Vim Emulator ...

  9. ThreadLocal以及内存泄漏

    ThreadLocal是什么 ThreadLocal 的作用是提供线程内的局部变量,这种变量在线程的生命周期内起作用,减少同一个线程内多个函数或者组件之间一些公共变量的传递的复杂度.但是如果滥用Thr ...

  10. numpy笔记—ravel和c_命令(区别flatten)

    np.c_给numpy数组添加列 np.r_给numpy数组添加行 ravel(): 将多维数组降成一维, 返回的是视图