Nginx + keepalived for dual-machine hot standby and tomcat Load Balancing
Environment Description:
nginx1:192.168.2.47nginx2:192.168.2.48tomcat1:192.168.2.49tomcat2:192.168.2.50vip:192.168.2.51
I. nginx Configuration1. Install the PCRE Library required by nginxWget ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/pcre-8.10.tar.gz
tar -zxvf pcre-8.10.tar.gzcd
./*[Email protected] root]# vi index.jsp # #这里注意tomcat1和2服务器的网页不同, respectively, set to Test1,test2: WqTo access the test separately:HTTP://IP Address: 8080/Configure front-end Nginx:Yum-y Install Pcre-devel zlib-devel openssl-develUseradd-s/bin/false NginxTar axvf nginx-1.6.2.tar.gzCD nginx-1.6.2./configure--prefix=/usr/local/nginx--user=nginx--group=nginx--with-file-aio--with-http_stub_status_module-- With-http_gzip_static_module--with-http_flv_module \--with-http_ssl_module make make InstallV
In the Apache + Tomcat load Balancing mode, through the REQUEST.GETLOCALADDR () can not get the server-side IP address, the return value is null problem, looked under, Baidu did not have the valuable answer, to the official website to find the next, said is:The AJP protocol only passes the Web server host name and port. It does not pass the IP address. Therefore,
: This article mainly introduces nginx + tomcat server load balancer. if you are interested in the PHP Tutorial, refer to it. 1: install nginx
Http://note.youdao.com/share? Id = 807b96d20c08495e0b5a3b97c44c8451 type = note
2: start and close
Http://note.youdao.com/share? Id = 5c6ffc9bef1d5f9899ca28ebdb8c4633 type = note
3: modify nginx. conf
Http://note.youdao.com/share? Id = 2d472652b1f551c00153e10b
Nginx and Tomcat do load balancing when there is an important issue to consider, that is the session.Imagine that, assuming Nginx has a polling policy, the application is deployed to TOMCAT1 and TOMCAT2, and the user is asked to log on when they access the TOMCAT1, so the user logs on. The next time the user launches the application request, will be processed by
Work needs, research the Nginx reverse proxy to achieve load balancing, search the web for a tutorial, mostly vague, so write this, right when summed up, convenient to see later, if you can help some people need, it is betterFirst, the requirements, the domain name to build the Nginx Server A, and then by a load balancer to the Server B and server C with
Nginx local access path instead of the usual localhost that we tomcat access, although very similar but not the same thing, nginx defaults to 80 ports and the tomcat default port is 8080.
Workaround:
Try the original WebService access address-that is, Tomcat's address before the load balancing is configured. Access to
jar package provided by memcached into two Tomcat LibThe copy Here isJavolution-5.4.3.1.jar,Memcached-session-manager-1.5.1.jar,Memcached-session-manager-tc7-1.5.1.jar,Msm-javolution-serializer-1.5.1.jar,Spymemcached-2.7.3.jarIn the context.xml of two comcat, the interception request is provided here to memcached the function of getting session objectClassname= "De.javakaffee.web.msm.MemcachedBackupSessionManager"Memcachednodes= "n1:192.168.101.243:1
:00nginx:masterprocess/data/ nginx/sbin/nginxnobody89928991016:43? 00:00:00nginx:workerprocessroot 89941907016:44pts/100:00:00 grepnginx[[emailprotected]lib64]#netstat-anpt|grepnginxtcp 000.0.0.0:80 0.0.0.0:* LISTEN 8991/nginx 3. Configure the Nginx Web reverse proxy to achieve two Tomcat load balancing: The Nginx configuration file is as follows:[[emailprotecte
nginx+tomcat+memcached for load Balancing
Error when logging into project
Nginx
Tomcat
memcached
Load Balancing
Cluster Configuration
share to:
more
------Solution--------------------Come to the wrong place
Tomcat has nginx or other software to do load balancing, Tomcat needs to record the real client address, need to define the following in host or context:
The code is as follows
Copy Code
Prefix= "Localhost_access_log." suffix= ". txt" pattern= "%{x-forwarded-for}i%h%l%u%t%r%s%b" resolvehost
Nginx tomcat Cluster load balancing solution notes Windows download nginx address: http://nginx.org/the version used in this article is 1.5.1 download after decompression, In the conf directory to modify nginx. conf: # user nobody; worker_processes 1; # error_log logs/error. log; # error_log logs/error. log notice; # error_log logs/error. log info; # pid logs/ngi
How to install is not introduced, their own online search.
Configure Nginx. This is then configured on a CAS single sign-on.
[Java] view plain copy upstream 127.0.0.1 {server 127.0.0.1:18080 weight=2; Server 127.0.0.1:28080 weight=2; Server 127.0.0.1:8080 weight=3; }Weight is the weight value, the larger the number, the greater the chance of being visited.
Modify apache-tomcat-6.0.37\conf and apache-tomcat1\conf and apache-tomcat2\ separately conf
/{# root HTML; # index index.html index.htm; # } #}}Second, set up the Tomcat cluster session sharing1.Modify the Conf/server.xml port in three tomcat directoriesand Tomcat 123 for JVM 123, respectively.2.Launched Tomcat 123 and Nginx, respectively, to access the IP:80 entry project is successfulSession whethe
again, Apache does not detect it, and it still does not forward requests to the past. The common advantage of r-proxy and MOD_JK is that. You can only put Apache on the public network, save the public network IP address resources. This can be done by setting up Apache to handle static Web pages specifically, so that Tomcat is specifically responsible for dynamic requests such as JSP and servlet. The common disadvantage is that all cluster services wi
Nginx + tomcat + memcached: error nginxtomcatmemcach nginx + tomcat + memcached when you log on to the project to achieve load balancing
An error occurred while logging on to the project.
Nginx tomcat memcached server load balan
/nginxstatus {stub_status on; Access_log on; Auth_basic "Nginxstatus"; Auth_basic_user_file/usr/local/nagois
/etc/htpasswd.users;
} error_page 404/404.html;
Error_page 502 503 504/50x.html;
Location =/50x.html {root html;}} }
Start the server
/usr/local/nginx/sbin/nginx
The kitten is successful when the browser is visited.
The above is a small set to introduce the NGINX+TOMCAT+HTTPS server load
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.