一、下載軟件
1.Apache 2.2.19
http://mirror.bjtu.edu.cn/apache//httpd/binaries/win32/httpd-2.2.19-win32-x86-no_ssl.msi
2.Tomcat 6.0.32
http://mirror.bjtu.edu.cn/apache/tomcat/tomcat-6/v6.0.32/bin/apache-tomcat-6.0.32-windows-x86.zip
3.Apache Tomcat Connector(mod_jk 1.2.31)
http://apache.etoak.com//tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.31/mod_jk-1.2.31-httpd-2.2.3.so
二、安裝配置
(1) Apache
1.直接默認(rèn)下一步安裝完成。(默認(rèn)目錄:$APACHE_HOME=C:\Program Files\Apache Software Foundation\Apache2.2\)
2.將下載好的mod_jk-1.2.31-httpd-2.2.3.so拷貝至$APACHE_HOME\modules,并重命名為:mod_jk.so。
3.編輯Apache目錄下的conf/httpd.conf文件,在末尾添加:
# include mod_jk
Include conf/jk/mod_jk.conf
4.在$APACHE_HOME\conf目錄下建立jk目錄,并新建mod_jk.conf,uriworkermap.properties,workers.properties三個(gè)文件。
5.編輯mod_jk.conf并增加:
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/jk/workers.properties
JkMountFile conf/jk/uriworkermap.properties
JkLogFile logs/mod_jk.log
JkShmFile logs/mod_jk.shm
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkRequestLogFormat "%w %V %T"
JkMount /* controller
6.編輯workers.properties并增加:
worker.list = controller,status,tomcat1,tomcat2
worker.template.type=ajp13
worker.template.ping_mode=A
worker.template.ping_timeout=20000
worker.template.connection_pool_size=1024
worker.template.socket_keepalive=true
worker.template.socket_connect_timeout=20000
worker.tomcat1.reference=worker.template
worker.tomcat1.port=8009
worker.tomcat1.host=localhost
worker.tomcat2.reference=worker.template
worker.tomcat2.port=9009
worker.tomcat2.host=localhost
worker.controller.type=lb
worker.controller.balanced_workers=tomcat1,tomcat2
worker.controller.sticky_session=false
worker.status.type=status
worker.status.read_only=true
7.編輯uriworkermap.properties并增加:
/*=controller
#!/*.gif=controller
#!/*.jpg=controller
#!/*.png=controller
#!/*.css=controller
#!/*.js=controller
#!/*.htm=controller
#!/*.html=controller
/jkstatus=status
(2) TOMCAT
1.解壓兩次apache-tomcat-6.0.32-windows-x86.zip,文件夾分別命名:tomcat1,tomcat2
2.如果是同一臺(tái)電腦上測(cè)試,則需要修改其中之一的server.xml文件中的端口
其它
在Apache Momitor 中添加或者刪除Service,
使用httpd -k install 或者 httpd -k uninstall (在$APACHE_HOME\bin目錄下執(zhí)行)
(3) Session復(fù)制
具體見%Tomcat_home%/webapps/docs/cluster-howto.html
To run session replication in your Tomcat 6.0 container, the following steps should be completed:
- All your session attributes must implement
java.io.Serializable
- Uncomment the
Cluster
element in server.xml - If you have defined custom cluster valves, make sure you have the
ReplicationValve
defined as well under the Cluster element in server.xml - If your Tomcat instances are running on the same machine, make sure the
tcpListenPort
attribute is unique for each instance, in most cases Tomcat is smart enough to resolve this on it's own by autodetecting available ports in the range 4000-4100 - Make sure your
web.xml
has the <distributable/>
element or set at your <Context distributable="true" />
- If you are using mod_jk, make sure that jvmRoute attribute is set at your Engine
<Engine name="Catalina" jvmRoute="node01" >
and that the jvmRoute attribute value matches your worker name in workers.properties - Make sure that all nodes have the same time and sync with NTP service!
- Make sure that your loadbalancer is configured for sticky session mode.
posted on 2011-06-16 12:02
Ke 閱讀(1256)
評(píng)論(0) 編輯 收藏 所屬分類:
tomcat