标签:-- backup ip地址 比较 实践 nginx 基于 包含 其他
upstream backend { server backend1.example.com weight=5; server backend2.example.com:8080; server unix:/tmp/backend3; server backup1.example.com:8080 backup; server backup2.example.com:8080 backup; } server { location / { proxy_pass http://backend; } }
resolver 10.0.0.1; upstream dynamic { zone upstream_dynamic 64k; server backend1.example.com weight=5; server backend2.example.com:8080 fail_timeout=5s slow_start=30s; server 192.0.2.1 max_fails=3; server backend3.example.com resolve; server backend4.example.com service=http resolve; server backup1.example.com:8080 backup; server backup2.example.com:8080 backup; } server { location / { proxy_pass http://dynamic; health_check; } }
// 权重 upstream backend { server 10.103.100.3:8090 weight=2; server 10.103.100.4:8090; } // 默认轮询 upstream backend { server 10.103.100.3:8090; server 10.103.100.4:8090; } server { listen 80; server_name localhost; location /{ proxy_pass http://backend; } }
// 带权重ip_hash upstream backend { ip_hash; server 10.103.100.3:8090 weight=2; server 10.103.100.4:8090; } // 普通ip_hash upstream backend { ip_hash; server 10.103.100.3:8090; server 10.103.100.4:8090; } server { listen 80; server_name localhost; location /{ proxy_pass http://backend; } }
标签:-- backup ip地址 比较 实践 nginx 基于 包含 其他
原文地址:http://www.cnblogs.com/Aiapple/p/7367877.html