一、下载软件
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.直接默认下一步安装完成。(默认目录:$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三个文件。
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.如果是同一台电脑上测试,则需要修改其中之一的server.xml文件中的端口
其它
在Apache Momitor 中添加或者删除Service,
使用httpd -k install 或者 httpd -k uninstall (在$APACHE_HOME\bin目录下执行)
(3) Session复制
具体见%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 阅读(1251)
评论(0) 编辑 收藏 所属分类:
tomcat