简体   繁体   中英

Weighted load balancing Nginx

Its my first time working with Nginx, and i started doing some balancing.

I have the next shema:

  • Nodejs app1 running (IP:5050).
  • Nodejs app2 running (IP:6060).

And i have this load balancing config:

upstream backend {
   #least_conn;
   #ip_hash;
   server 172.29.24.1:5050 weight=3;
   server 172.29.24.1:6060 weight=5;
}

I need to get this:

Make 1 of every 3 times load the first application and 2 of every 3 for the second application

I find a solution

upstream backend {
   #least_conn;
   #ip_hash;
   server 172.29.24.1:5050 weight=1;
   server 172.29.24.1:6060 weight=2;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM