Nginx负载均衡的六种策略

  1. 轮询(默认)
upstream pool {
  server 192.168.2.130:8000;
  server 192.168.2.131:8000;
}
  1. 权重
upstream pool {
  server 192.168.2.130:8000 weight=2;
  server 192.168.2.131:8000;
}
  1. IP绑定
upstream pool {
  ip_hash;
  server 192.168.2.130:8000;
  server 192.168.2.131:8000;
}
  1. 最少连接优先
upstream pool {
  least_conn;
  server 192.168.2.130:8000;
  server 192.168.2.131:8000;
}
  1. 响应最快优先(第三方)
upstream pool {
  fair;
  server 192.168.2.130:8000;
  server 192.168.2.131:8000;
}
  1. url绑定(第三方)
upstream pool {
  hash $request_uri;
  server 192.168.2.130:8000;
  server 192.168.2.131:8000;
}
posted @ 2020-07-08 10:26  Peterer~王勇  阅读(163)  评论(0编辑  收藏  举报