In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
Common Web cluster schedulers:
At present, the common Web cluster scheduler is divided into software and hardware, the software usually uses open source LVS, Haproxy, Nginx, the hardware is generally used F5, and many people use some domestic products, such as barracuda, Green League and so on.
Haproxy Application Analysis LVS has strong anti-load ability in enterprise applications, but it has some shortcomings.
1.LVS does not support regular processing and cannot achieve static and dynamic separation.
two。 For large websites, the implementation and configuration of LVS is complex, and the maintenance cost is relatively high.
Haproxy is a software that provides high availability, load balancing, and agents based on TCP and HTTP applications
1. It is especially suitable for Web sites with heavy load.
two。 Run on the current hardware. Can support tens of thousands of concurrent connection requests on the
Haproxy scheduling algorithm principle Haproxy supports a variety of scheduling algorithms, the most commonly used are 3:
1.RR (Round Robin):
RR algorithm is the simplest and most commonly used algorithm, that is, polling.
two。 Understanding examples:
There are three nodes A, B, C, the first user access will be assigned to node A, the second user access will be assigned to node B, the third user access will be assigned to the node and the fourth user access will continue to be assigned to node A, polling allocation access requests to achieve load balancing effect
Haproxy supports a variety of scheduling algorithms, of which three are the most commonly used: 1.SH (Source Hashing):
SH is a source-based access scheduling algorithm. This algorithm is used in some scenarios where Session sessions are recorded on the server, and cluster scheduling can be done based on source IP, Cookie, etc.
two。 Understand examples
① has three nodes A, B and C. the first user is assigned to A for the first visit, and the second user is assigned to B for the first visit.
② will continue to be assigned to A when the first user visits the second time, and the second user will still be assigned to B on the second visit. As long as the load balancer scheduler does not restart, the first user access will be assigned to A, and the second user access will be assigned to B to achieve cluster scheduling.
③ this scheduling algorithm has the advantage of session persistence, but when the traffic of some IP is very large, it will cause load imbalance, and the traffic of some nodes is too large, which will affect the business usage.
Demo: environmental preparation:
Nginx1:192.168.100.201---- > CentOS 7-2
Nginx2:192.168.100.202---- > CentOS 7-3
Dispatching server: 192.168.100.210Murray-> CentOS 7-4
Client: 192.168.100.58 Murmuri-> win 7-1
Operation of Nginx2:CentOS 7-3 [root@localhost ~] # yum install pcre-devel zlib-devel gcc gcc-c++ make-y sign / change the Nic to host-only mode [root@localhost ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens33BOOTPROTO= "static" IPADDR=192.168.100.201NETMASK=255.255.255.0GATEWAY=192.168.100.1// after modification, enter: wq save exit [root@localhost ~] # service network restart Restarting network (via systemctl): [OK] [root@localhost ~] # mkdir / aaa [root@localhost ~] # mount.cifs / / 192.168.10.189/rpm / aaaPassword for root@//192.168.10.189/rpm: [root@localhost ~] # cd / aaa [root@localhost aaa] # lsapr-1.6.2.tar.gz jdkapr-util-1.6.0.tar.gz john- 1.8.0.tar.gzawstats-7.6.tar.gz lf.jpgcronolog-1.6.2-14.el7.x86_64.rpm mysqlDiscuz_X3.4_SC_UTF8.zip nginx-1.12.2.tar.gzerror.png phpextundelete-0.2.4.tar.bz2 TChaproxy-1.5.19.tar.gz tomcathttpd-2. 4.29.tar.bz2 tomcat.tmphzw.jpeg wh.jpg [root@localhost aaa] # cd tomcat/ [root@localhost tomcat] # lsapache-tomcat-7.0.54.tar.gz jdk-8u91-linux-x64.tar.gzapache-tomcat-8.5.16.tar.gz nginx-1.12.0.tar.gzjdk-7u65-linux-x64.gz nginx-1.6.0.tar.gz [ Root@localost tomcat] # tar zxvf nginx-1.12.0.tar.gz-C / opt/ [root@localhost tomcat] # cd / opt/ [root@localhost opt] # useradd-M-s / sbin/nologin nginx [root@localhost opt] # cd nginx-1.12.0/ [root@localhost nginx-1.12.0] # lsauto CHANGES.ru configure html man srcCHANGES conf contrib LICENSE README [root@localhost nginx-1.12.0] #. / configure \-prefix=/usr/local/nginx\-user=nginx\-group=nginx [root@localhost nginx-1.12.0] # make & & make install [root@localhost nginx-1.12.0] # cd / usr/local/nginx/html/ [root@localhost html] # echo "this is accp web" > test.html [root@localhost html] # ln-s / usr/local/nginx/sbin/nginx / usr/local/sbin/ [root@localhost html] # nginx- tnginx: the configuration file / usr / local/nginx/conf/nginx.conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is successful [root@localhost html] # nginx [root@localhost html] # netstat-ntap | grep 80tcp 00 0.0.0.0 usr/local/nginx/conf/nginx.conf test is successful 80 0.0.0.0 master * LISTEN 6408/nginx: master [root@localhost html] # systemctl stop firewalld.service [root@localhost html] # setenforce 0 Enter: http://127.0.0.1/test.html validation in Firefox browser: this is accp web is displayed
Operation of Nginx1:CentOS 7-2 [root@localhost ~] # yum install pcre-devel zlib-devel gcc gcc-c++ make-y sign / change the Nic to host-only mode [root@localhost ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens33BOOTPROTO= "static" IPADDR=192.168.100.202NETMASK=255.255.255.0GATEWAY=192.168.100.1// after modification, enter: wq save exit [root@localhost ~] # service network restart Restarting network (via systemctl): [OK] [root@localhost ~] # mkdir / aaa [root@localhost ~] # mount.cifs / / 192.168.10.189/rpm / aaaPassword for root@//192.168.10.189/rpm: [root@localhost ~] # cd / aaa [root@localhost aaa] # lsapr-1.6.2.tar.gz jdkapr-util-1.6.0.tar.gz john -1.8.0.tar.gzawstats-7.6.tar.gz lf.jpgcronolog-1.6.2-14.el7.x86_64.rpm mysqlDiscuz_X3.4_SC_UTF8.zip nginx-1.12.2.tar.gzerror.png phpextundelete-0.2.4.tar.bz2 TChaproxy-1.5.19.tar.gz tomcathttpd-2 .4.29.tar.bz2 tomcat.tmphzw.jpeg wh.jpg [root@localhost aaa] # cd tomcat/ [root@localhost tomcat] # lsapache-tomcat-7.0.54.tar.gz jdk-8u91-linux-x64.tar.gzapache-tomcat-8.5.16.tar.gz nginx-1.12.0.tar.gzjdk-7u65-linux-x64.gz nginx-1.6.0.tar.gz [root@localost tomcat] # tar zxvf nginx-1.12.0.tar.gz-C / opt/ [root@localhost tomcat] # cd / opt/ [root@localhost opt] # useradd-M-s / sbin/nologin nginx [root@localhost opt] # cd nginx-1.12.0/ [root@localhost nginx-1.12.0] # lsauto CHANGES.ru configure html man srcCHANGES conf contrib LICENSE README [root@localhost nginx-1.12.0] # / Configure\-prefix=/usr/local/nginx\-user=nginx\-group=nginx [root@localhost nginx-1.12.0] # make & & make install [root@localhost nginx-1.12.0] # cd / usr/local/nginx/html/ [root@localhost html] # echo "this is benet web" > test.html [root@localhost html] # ln-s / usr/local/nginx/sbin/nginx / usr/local/sbin/ [root@localhost html] # nginx- tnginx: the configuration file / Usr/local/nginx/conf/nginx.conf syntax is oknginx: configuration file / usr/local/nginx/conf/nginx.conf test is successful [root@localhost html] # nginx [root@localhost html] # netstat-ntap | grep 80tcp 00 0.0.0.0 root@localhost html 80 0.0.0.0 master * LISTEN 6408/nginx: master [root@localhost html] # systemctl stop firewalld.service [root@localhost html] # setenforce 0 enter: http://127.0.0.1/test.html verification in Firefox browser: this is benet web is displayed
Dispatch server: operation of CentOS 7-4 [root@localhost ~] # yum install bzip2-devel pcre-devel gcc gcc-c++ make-y hand / change Nic to host-only mode [root@localhost ~] # vim / etc/sysconfig/network-scripts/ifcfg-ens33BOOTPROTO= "static" IPADDR=192.168.100.210NETMASK=255.255.255.0GATEWAY=192.168.100.1// after modification, enter: wq save exit [root@localhost ~] # service network restart Restarting network (via systemctl): [OK] [root@localhost ~] # mkdir / aaa [root@localhost ~] # mount.cifs / / 192.168.10.189/rpm / aaaPassword for root@//192.168.10.189/rpm: [root@localhost ~] # cd / aaa [root@localhost aaa] # lsapr-1.6.2.tar.gz jdkapr-util-1.6.0.tar.gz John-1.8.0.tar.gzawstats-7.6.tar.gz lf.jpgcronolog-1.6.2-14.el7.x86_64.rpm mysqlDiscuz_X3.4_SC_UTF8.zip nginx-1.12.2.tar.gzerror.png phpextundelete-0.2.4.tar.bz2 TChaproxy-1.5.19.tar.gz Tomcathttpd-2.4.29.tar.bz2 tomcat.tmphzw.jpeg wh.jpg [root@localhost aaa] # tar zxvf haproxy-1.5.19.tar.gz-C / opt/ [root@localhost aaa] # cd / opt [root@localhost opt] # lshaproxy-1.5.19 rh [root@localhost opt] # cd haproxy-1.5.19/ [root@localhost haproxy-1.5.19] # make TARGET=linux26 [root @ localhost haproxy-1.5.19] # make install [root@localhost haproxy-1.5.19] # mkdir / etc/haproxy [root@localhost haproxy-1.5.19] # cp examples/haproxy.cfg / etc/haproxy/ [root@localhost haproxy-1.5.19] # vim / etc/haproxy/haproxy.cfg / / where the chroot / usr/share/haproxy root directory is deleted / / where the redispatch request is forwarded to the down server to delete / / all the Listen below are deleted Press 88dd// and then add the following content listen webcluster 0.0.0.0test.html balance roundrobin server instl 80 option httpchk GET / test.html balance roundrobin server instl 192.168.100.201 test.html balance roundrobin server instl 80 check inter 2000 fall 3 server inst2 192.168.100.202 88dd// 80 check inter 2000 cp examples/haproxy.init 3 / after modification is completed, enter: wq save exit [root@localhost haproxy-1.5.19] # cp examples/haproxy.init / etc/init.d/haproxy [root @ localhost haproxy-1.5.19] # chmod + x / etc/init.d/haproxy [root@localhost haproxy-1.5.19] # chkconfig-- add haproxy [root@localhost haproxy-1.5.19] # ln-s / usr/local/sbin/haproxy / usr/sbin/haproxy [root@localhost haproxy-1.5.19] # service haproxy startStarting haproxy (via systemctl): [OK] [root@localhost haproxy-1.5 .19] # systemctl stop firewalld.service [root@localhost haproxy-1.5.19] # setenforce 0win7-1 test result: 1. In win 7-1, the network card is set to host-only mode, and then in the network card configuration, IPv4 is set to static IP:192.168.100.58 (which needs to be in the same network segment). The gateway is 255.255.255.02. Then type: http://192.168.100.210/test.html in the browser and you will first see: this is accp web
Refresh again and you will see: this is benet web
Polling access to the nginx node is implemented at this 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.