Deploy two Tomcat servers on the same server and use Nginx for Load Balancing
To achieve server upgrade without affecting user usage, it is necessary to configure two tomcat servers in one or more servers. The following describes how to configure two Tomcat servers on the same server.
The procedure is as follows:
1. Copy the original Tomcat to another directory, for example, tomcat-8090. Clear the logs directory.
2. Modify the server. xml file in Tomcat and change the shutdown and Connector ports to another value, such as 8006/8090.
3. Modify the startup. sh and shutdown. sh files and add the following to the first line:
Export CATALINA_HOME =/opt/app/tomcat-8090
4. start tomcat
5. configure Server Load balancer in Nginx:
Nginx configuration file, add:
Upstream tomcatCluster {
Server <ip>: 8080;
Server <ip>: 8090;
}
Server
{
Listen 80;
Server_name <ip> <Domain Name> ......;
Index ......;
Root ......;
Location /{
Location ~ */<Project Name> /{
Proxy_pass http: // tomcatCluster;
}
}
}
Restart Nginx: service nginx restart
6. Test whether requests are forwarded to two tomcat servers in turn.
Tomcat Load Balancing using Nginx reverse proxy in CentOS 6.5
Load Balancing between Apache and multiple Tomcat clusters in Linux
Nginx Tomcat Cluster load balancing solution notes
Instance details Tomcat component installation + Nginx reverse proxy Tomcat + Apache use mod_jk and mod_proxy Reverse Proxy and load balancing
Deploy a log server using Rsyslog + LogAnalyzer + MySQL in CentOS 6.5
Build an Apache + Tomcat environment (JK deployment process)
Tomcat details: click here
Tomcat: click here
This article permanently updates the link address: