In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
Load balancing (Cloud Load Balancer) is a service that distributes traffic to multiple CVMs. Load balancing can expand the external service capacity of the application system through traffic distribution and improve the availability of the application system by eliminating a single point of failure. The cloud load balancer service virtualizes multiple CVM resources located in the same region into a high-performance and highly available application service pool by setting virtual service addresses (VIP). Distribute the network requests from the client to the cloud server pool according to the way specified by the application. The load balancer service checks the health status of the CVM instances in the CVM pool and automatically isolates the abnormal instances, thus solving the single point problem of the CVM and improving the overall service capability of the application. Today, I will introduce to you what the environment of load balancing is like.
Create a new virtual machine and install CentOS. CentOS-6.4-i386-bin-DVD1.iso is used here. Note that it is 32-bit.
Please check the connection: https://blog.51cto.com/11009785/2288310
1. Set up the basic linux environment
Please check the connection: https://blog.51cto.com/11009785/2388623
two。 Install jdk (java1.7 used here)
Download address: https://www.oracle.com/technetwork/java/javase/archive-139210.html
The version of jdk-7u60-linux-i586.rpm is used
After downloading the rpm package, upload it to CentOS through xshell and using the rz command
Give full permissions first:
Chmod 777 jdk-7u60-linux-i586.rpm
Reinstall:
Rpm-ivh jdk-7u60-linux-i586.rpm
After installation, configure the environment variables:
Vi / etc/profile
Add at the end:
Export JAVA_HOME=/usr/java/jdk1.7.0_60
Export CLASSPATH=.:$JAVA_HOME/lib
Export PATH=$JAVA_HOME/bin:$PATH
Save Fil
Reload the environment variables:
Source / etc/profile
Verify that the installation was successful:
Java-version
3. Install nginx
Download nginx-1.9.1.tar.gz and upload it to CentOS via xshell using the rz command
Decompress:
Tar-zxvpf nginx-1.9.1.tar.gz
Enter the nginx directory and execute the following command:
. / configure-- prefix=/opt/nginx-- with-http_stub_status_module-- with-http_ssl_module-- with-threads-- with-pcre= here write the path after pcre-8.37 decompression
Make
Make install
Verify:
/ opt/nginx/sbin/nginx-t
Start:
/ opt/nginx/sbin/nginx
Check to see if it starts:
Ps-ef | grep nginx
Visit ip and the welcome page appears
If you need to restart, use:
/ opt/nginx/sbin/nginx-s reload
Ps-ef | grep nginx
4. Install tomcat
Download apache-tomcat-7.0.62.tar.gz and upload it to CentOS via xshell using the rz command
Decompress:
Tar-zxvpf apache-tomcat-7.0.62.tar.gz
After decompression, rename it to tomcat1
Mv apache-tomcat-7.0.62 tomcat1
Extract it again and rename it to tomcat2
Mv apache-tomcat-7.0.62 tomcat2
Put tomcat1 and tomcat2 in the / opt directory
Mv tomcat1 / opt
Mv tomcat2 / opt
There are three main ports:
Shutdown port 8005 is mainly responsible for starting and shutting down
Ajp port 8009 is mainly responsible for balancing through ajp
Http port 8080 can be accessed directly through the web page
If the three ports of tomcat1 are 8005 8009 8080 respectively
Then the three ports of tomcat2 are all added 1000 on this basis, that is, 9005 9009 9080
View the port of tomcat1:
Cd / opt/tomcat1/conf
Vi server.xml
/ 8005 found 8005 (one place), / 8009 found 8009 (two places), / 8080 found 8080 (three places)
Modify the port of tomcat2:
Cd / opt/tomcat2/conf
Vi server.xml
/ 8005 found 8005 (one place), modified to 9005
/ 8009 found 8009 (in two places), modified to 9009
/ 8080 found 8080 (in three places), modified to 9080
To distinguish between tomcat1 and tomcat2, modify their home page index.jsp respectively:
Cd / opt/tomcat1/webapps/ROOT
Vi index.jsp
/ Home find the location of Home, change it to Home111111, and save it
Cd / opt/tomcat2/webapps/ROOT
Vi index.jsp
/ Home find the location of Home, change it to Home222222, and save it
Start tomcat1:
Cd / opt/tomcat1/bin
Sh startup.sh
Check to see if it starts:
Ps-ef | grep catalina
View the log:
Cd opt/tomcat1/logs
Tail-f catalina.out
In the same way, start tomcat2
Check to see if both tomcat are started:
Ps-ef | grep catalina
Verify and access the corresponding port:
Http://192.168.0.103:8080 corresponds to tomcat1
Http://192.168.0.103:9080 corresponds to tomcat2
5. Integrate nginx+tomcat
Modify the nginx configuration file:
Cd / opt/nginx/conf
Vi nginx.conf
Note that the names should be unified, for example, they are all called web_app here.
After modification, save.
Restart nginx:
/ opt/nginx/sbin/nginx-s reload
Among them, proxy_pass is a homecoming Dai Li with engx.
Verify:
If you directly access the virtual machine ip, refresh it with F5 or use Ctrl+F5 strong brush, you will see that you have visited different tomcat
Note that if there is a problem, check the nginx log and see the specific error report to solve it.
Finally, attach a picture to see the position of nginx and tomcat in the architecture
If there is anything else you need to know, you can find our professional technical engineer on the official website. The technical engineer has more than ten years of experience in the industry, so it will be more detailed and professional than the editor's answer. Official website link www.yisu.com
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.