Use Nginx+memcached+tomcat to configure load balancing cluster and session sharing
Configuration Environment: under windows xp jdk1.7.0_10 nginx-1.2.6 (download attached) memcached-1.2.6-win32-bin.zip (download attached) tomcat7.0.12 *(Note: nginxLoad balancing will not have a big problem, but when configuring session sharing with memcached, the version of tomcat may become the key to success or failure, The tomcat7.0.34 used at the beginning always throws an exception, the reason should be that there is no jar package matching the latest tomcat’s memcached) 1. First, use nginx to build a load balancing environment for three tomcat servers. For how to start three tomcats on one machine, please refer to “Start three tomcats on one machine” The ports of my tomcat are 8081, 8082, 8083 Unzip the downloaded nginx compressed package, my path is D:\MyServer; In D:\MyServer\nginx-1.2.6\conf Next, find nginx.conf, which is the request distribution configuration file for nginx. Open nginx.conf and make the following modifications: (1) in http {…} – server{…} – location / Add a line to {…}: “proxy_pass http://127.0.0.1;” After modification, it is as follows: location / { root html; Index index.html index.htm; Proxy_pass http://127.0.0.1; } (2) Add the following code to http {…}: #Set load balancing server list upstream 127.0.0.1 { The #weigth parameter represents the weight, the higher the weight, the greater the…