1. http load balancing
upstream backend {
server 10.10.10.10:80 weight=1;
server test.com:80 weight=2;
}
server {
location / {
proxy_pass http://backend;
}
}
2. tcp load balancing
stream {
upstream mysql_read {
server test1.com:3306 weight=5;
server test2.com:3306;
server 10.10.10.11:3306 backup;
}
server {
listen 3306;
proxy_pass mysql_read;
}
}
3. load-balacing methods
1) least_conn 접속 (hash/ip_hash등등)
upstream backend {
least_conn;
server test1.com;
server test2.com;
}
2) 접속 제한 (NGINX Plus 기능)
upstream backend {
zone backends 64k;
queue 750 timeout=30s;
server test1.com max_conns=25;
server test2.com max_conns=15;
}
'오픈소스 > nginx' 카테고리의 다른 글
nginx media service (0) | 2018.11.27 |
---|---|
nginx cache (0) | 2018.11.27 |
nginx mysql load balancing (0) | 2018.10.05 |
nginx 디렉토리 설정예제 (0) | 2018.05.04 |
nginx proxy 설정예제 (0) | 2018.05.04 |