1、选择两台服务器,其中一台Server1装上Apache和Tomcat,另外一台Server2装Tomcat
2、下载Connector,将mod_jk2.so文件拷贝到%Apache_Home%/modules/目录下。
3、修改%Apache_Home%/conf/httpd.conf文件,在适当位置加入以下代码:LoadModule jk2_module modules/mod_jk2.so
4、在%Apache_Home%/conf/下创建workers2.properties文件,内容如下:
[logger.apache2]
level=DEBUG
#第一个Tomcat的配置
[channel.socket:tomcat1]
port=8009
host=Server1 # Server 1 IP
# 定义worker
[ajp13:tomcat1]
channel=channel.socket:tomcat1
#第二个Tomcat的配置
[channel.socket:tomcat2]
port=8009
host= Server2 # Server 2 IP
#定义worker
[ajp13:tomcat2]
channel=channel.socket:tomcat2
#定义Balancer(负载均衡器)
[lb:lb]
worker=ajp13:tomcat1
worker=ajp13:tomcat2
#Uri的映射
[uri:/*]
group=lb:lb
5、修改Tomcat配置文件%Tomcat_Home%/conf/server.xml,在Engine标签内加入:jvmRoute="tomcat1" Server1用tomcat1,Server2用tomcat2
6、本配置在Windows XP和RedHat Linux下调试通过