1、轮询
upstream backend{
server 192.168.0.1:8080;
server 192.168.0.2:8080;
}
2、权重值分配
upstream backend{
server 192.168.0.1:8080 weight=2;
server 192.168.0.2:8080 weight=3;
}
weight值和负载权重成正比,weigh默认为1,weight越大,负载越高
3、按照来源ip分配
根据hash(ip)的结果设置访问服务器,ip不变的情况下,访问的服务器也是固定的
upstream backend{
ip_hash;
server 192.168.0.1:8080;
server 192.168.0.2:8080;
}
4、根据服务器响应时间分配
需要安装 Upstream Fair Balancer Module
upstream backend{
fair;
server 192.168.0.1:8080;
server 192.168.0.2:8080;
}
5、自定义hash(url_hash)
需要安装Upstream Hash Module,使得想同url访问同一台服务器
upstream backend{
server 192.168.0.1:8080;
server 192.168.0.2:8080;
hash $request_uri;
}
此外upstream每个后端的可设置参数为:
1.down: 表示此台server暂时不参与负载。
2.weight: 默认为1,weight越大,负载的权重就越大。
3.max_fails: 允许请求失败的次数默认为1.当超过最大次数时,返回proxy_next_upstream模块定义的错误。
4.fail_timeout: max_fails次失败后,暂停的时间。
5.backup: 其它所有的非backup机器down或者忙的时候,请求backup机器,应急措施
分享到:
相关推荐
官方nginx 镜像不带主动健康,本镜像将 nginx_upstream_check健康检查 打包到了镜像中。
此资源有两个文件,含 nginx-upstream-jvm-route 和 nginx 对应版本,都是tar.gz文件。 安装方法网上很多就不写了,亲测可用。 不用担心版本不匹配造成安装失败,再浪费积分去到处下载尝试的烦恼。 此资源有两个文件...
linux nginx nginx_upstream_jvm_route
nginx-upstream-jvm-route 支持nginx版本1.15 解决nginx: [emerg] invalid parameter "srun_id=tomcat1" 问题
nginx配置upstream的资源文件文件,下载下来直接上传至服务解压即可
NGINX第三方模块:nginx_upstream_hash-0.3.1.tar.gz。
NGINX第三方模块:nginx_upstream_hash-0.3.2版本。。。
nginx1.16版本 后端节点健康检查、自动隔离+nginx_upstream_check_module-master+nginx-upload-module
如果直接用内网ip访问是正常的,所以可以判定是nginx的问题,nginx配置如下 upstream tomcat { server 192.168.11.172:8061; server 192.168.11.172:8062; ip_hash; } server { listen 8060; server_name ...
nginx_upstream_jvm_route 是一个 Nginx 的扩展模块,用来实现基于 Cookie 的 Session Sticky 的功能。 安装方法(进入Nginx源码目录): #patch -p0 # ./configure --prefix=/usr/nginx-0.8.1 --with-...
这是一个很小的脚本文件用来管理 Nginx 的 upstream 配置。 使用方法:upstream_manager.py <cluster> <action> [...]
Nginx upstream urlhash url hash 反向代理 Nginx upstream urlhash url hash 反向代理
nginx优化之request_time 和upstream_response_time差别笔者在根据nginx的accesslog中$request_time
Nginx所需环境的安装,及nginx安装,nginx相关功能开启,后端节点健康检查插件安装,静态资源缓存插件,缩略图插件安装等。
nginx+php,让nginx支持PHP的PATHINFO路由模式_亲测成功.zip apache+php支持PATHINFO路由模式非常容易,但是nginx对pathinfo可不支持,需要你自己配置正则路径.看看我怎么配的
nginx_upstream_jvm_route 是一个 Nginx 的扩展模块,用来实现基于 Cookie 的 Session Sticky 的功能。 安装方法(进入Nginx源码目录): #patch -p0 # ./configure --prefix=/usr/nginx-0.8.1 --with-...
nginx_upstream_check_module模块,2019年11月6日18:11:19下载的
Nginx均衡负载-fair(第三方)模块,要实现这种均衡负载操作,必须给Nginx添加这个模块,否则,无法进行!
docker容器中编译安装第三方后端检查模块nginx_upstream_check_module 使用方法见:https://blog.csdn.net/pcn01/article/details/105182600