資源描述:
《nginx+keepalived+tomcat實現(xiàn)性負載均衡》由會員上傳分享,免費在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、Nginx+keepalived+tomcat實現(xiàn)性負載均衡試驗環(huán)境:CentOS5.4、pcre-8.12、nginx-upstream-jvm-route-0.1、nginx-1.0.10、apache-tomcat-7.0.23、keepalived-1.1.17.tar.gz、jdk-7u2-linux-x64.tar.gz主nginx服務(wù)器地址:10.29.9.200輔nginx服務(wù)器地址:10.29.9.201tomcat1:10.29.9.202tomcat2:10.29.9.203VIP:10.29.9.188
2、拓撲如下:1.分別在10.29.9.200和10.29.9.201上面安裝nginxtarzxfpcre-8.12.tar.gzcdpcre-8.12./configuremake;makeinstall下載下面的插件安裝,否則nginx無法識別tomcat中jvmRoute,從而無法達到session復(fù)制的效果。wgethttp://friendly.sinaapp.com/LinuxSoft/nginx-upstream-jvm-route-0.1.tar.gztarxzfnginx-upstream-jvm-route-
3、0.1.tar.gztarxzfnginx-1.0.10.tar.gzcdnginx-1.0.10patch-p0<../nginx_upstream_jvm_route/jvm_route.patch./configure--prefix=/usr/local/nginx--with-http_stub_status_module--with-pcre=/root/pcre-8.12--add-module=../nginx_upstream_jvm_route/#--with-pcre=指向的是pcre的源碼包make;
4、makeinstall2.配置nginxvim/usr/local/nginx/conf/nginx.confuserwwwwww;worker_processes4;error_log/home/wwwlogs/nginx_error.logcrit;pid/usr/local/nginx/logs/nginx.pid;#Specifiesthevalueformaximumfiledescriptorsthatcanbeopenedbythisprocess.worker_rlimit_nofile51200;events
5、{useepoll;worker_connections51200;}http{upstreambackend{server10.29.9.202:8080srun_id=tomcat1;server10.29.9.203:8080srun_id=tomcat2;jvm_route$cookie_JSESSIONID
6、sessionidreverse;}includemime.types;default_typeapplication/octet-stream;server_names_hash_bucket_size128;
7、client_header_buffer_size32k;large_client_header_buffers432k;client_max_body_size50m;sendfileon;tcp_nopushon;keepalive_timeout60;tcp_nodelayon;fastcgi_connect_timeout300;fastcgi_send_timeout300;fastcgi_read_timeout300;fastcgi_buffer_size64k;fastcgi_buffers464k;fastc
8、gi_busy_buffers_size128k;fastcgi_temp_file_write_size256k;gzipon;gzip_min_length1k;gzip_buffers416k;charsetUTF-8gzip_http_version1.0;gzip_comp_level2;gzip_typestext/plainapplication/x-javascripttext/cssapplication/xml;gzip_varyon;#limit_zonecrawler$binary_remote_add
9、r10m;server{listen80;server_namewww.8090u.com;indexindex.jspindex.htmindex.html;root/home/wwwroot/;location/{proxy_passhttp://backend;prox