In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
According to the official documentation, the example shown below is given first.
Http {
Upstream myapp1 {
Server srv1.example.com
Server srv2.example.com
Server srv3.example.com
}
Server {
Listen 80
Location / {
Proxy_pass http://myapp1;
}
}
}
This example is to configure a http load balancing server group named myapp1
That is, the basic configuration format and syntax of http load balancing
Nginx load balancing includes three mechanisms: rotational training (round-robin), least connection (least-connected) and IP hash (ip-hash).
Rotational training: http requests sent to the server are rotated to the server in the load balancer configuration
Minimum connections: http requests sent to the server side are assigned to the server with the least number of active links in the load balancing configuration
IP hash: uses a hash method based on the client's IP address to determine which server is assigned to the request
The configuration method is as follows:
Least connection load balancer
Upstream myapp1 {
Least_conn
Server srv1.example.com
Server srv2.example.com
Server srv3.example.com
}
Ip hash
Upstream myapp1 {
Ip_hash
Server srv1.example.com
Server srv2.example.com
Server srv3.example.com
}
Rotational training
Upstream myapp1 {
Server srv1.example.com weight=3
Server srv2.example.com
Server srv3.example.com
}
Explanation: weight is weighted and defaults to 1. If there are five requests, the first three requests will be assigned to srv1, the fourth request to srv2, and the fifth request to srv3, and so on.
Note:
1. Default is rotational training.
2, the minimum number of connections and rotation mechanism will assign client requests to different servers during the client-server session, while ip hashes can maintain the session and keep the requests on the same server all the time
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.