关于nginx:nginx之upstream模块旧笔记暂存

1次阅读

共计 395 个字符,预计需要花费 1 分钟才能阅读完成。

nginx 模块三大类:1.handle 2.filter 3.upstream
其中 1 和 2 可在任何单机工作;3 是逾越单机限度,实现网络接管解决转发;

upstream test {ip_hash; // down 与其配合应用(暂时性宕机)
    server 192.168.0.1;
    server 192.168.0.2;
}

外围指令 ip_hash 只能在 upstream{} 中应用。它示意 nginx 应用 ip hash 负载平衡算法。
如果没有 ip_hash 指令,nginx 应用 Round Robin 负载平衡模块。

nignx 1.3.1 之前不能在 ip_hash 中使用权重 weight

  1. 轮询(默认) 每个申请按工夫程序逐个调配到后端
  2. weight 指定轮询几率,weight 和拜访比率成正比
  3. ip_hash 每个申请按 ip hash 后果调配,解决 session 问题(有局限)
  4. fair 按后端服务器的响应工夫调配,短时响应的后端节点优先
  5. url_hash
正文完
 0