upstream 模块
来源:互联网 发布:佳能打印机软件下载 编辑:程序博客网 时间:2024/06/05 19:33
1.ip_hash
upstream backend{
ip_hash;
server backend1.example.com;
server backend2.example.com;
server backend3.example.com down;
server backend4.example.com;
}
如果需要摘除一个服务器的时候必须标记为 down,而不是直接删除配置,这样 ip_hash 的时候就不会把 backend1 上的请求 hash 到 backend2 上
2.server
upstream backend {
server backend1.example/com weight=5;
server 127.0.0.1:8080 max_fails=3 fail_timeout=30s;
server unix:/tmp/backend3;
}
服务器的名称可以是一个域名,一个 ip 地址,端口号或 unix socket
参数: weight 权重;max_fails 请求失败次数,默认值1,设为 0 将关闭这项检查;fail_timeout 在经历参数 max_fails 设置的失败次数后,暂停的时间;down 标记服务器为永久离线状态,用于 ip_hash 指令;backup 仅仅在非 backup 服务器全部宕机或繁忙的时候才启用
3.upstream 指令
该指令用于设置一组可以在 proxy_pass 和 fastcgi_pass 指令中使用的代理服务器,默认的负载均衡方式为 轮询
upstream 变量:
$upstream_addr 处理请求 upstream 服务器地址
$upstream_status upstream 服务器的应答状态
$upstream_response_time upstream 服务器响应时间(毫秒),多个响应以逗号和冒号分割
$upstream_http_$HEADER 任意的 HTTP 协议头信息,例如: $upstream_http_host
0 0
- upstream 模块
- upstream模块(开发)
- nginx upstream 模块详解
- nginx upstream模块
- nginx upstream模块配置
- nginx反向代理--upstream模块
- nginx upstream模块--负载均衡
- nginx upstream模块--负载均衡
- [nginx] proxy和upstream模块
- upstream,proxy,nginx的模块
- Nginx的upstream模块和反向代理
- Nginx Upstream模块源码分析(上)
- Nginx学习——upstream模块
- nginx模块开发(三):upstream
- nginx配置详解之upstream模块
- Nginx模块(upstream和ngx_http_limit_req_module)使用
- 开发一个使用upstream的示例模块
- ngnix的upstream模块配置详解
- jenkins和linux环境配置遇到的几个注意点 && linux命令行下载历史android sdk
- Android LayoutInflater inflate方法效率
- 优化 Linux 内核参数
- 安装nodejs相关
- android_68_vitamio_videoView
- upstream 模块
- 蓝桥杯练习系统基础练习——01字符串
- 【深入剖析Tomcat笔记】第二篇 ServerSocket模型
- 漫步数学分析番外二(上)
- 查看源码 throw new RuntimeException("Stub!") 教你使用AndroidStudio关联源代码
- nginx 403 forbidden
- Go指南练习之《slice》
- mac idea15 maven project 导入无反应
- 1015. 德才论