标签:tomcat
该协议主要是以二进制的格式,而不是以文本的格式传输数据的。使用TCP和基于包的协议,增加了WEB服务器的性能。[root@localhost opt]# tar -zxvf tomcat-connectors-2.2.x-src.tar
[root@localhost opt]# tar -zxvf tomcat-connectors-2.2.x-src.tar
[root@localhost apache-2.0]# make
root@localhost apache-2.0]# make install
[root@localhost apache-2.0]# cp mod_jk.so /opt/apache-2.2.19/modules/
chmod 755 mod_jk.so
[root@localhost apache-2.0]# cd /opt/apache-2.2.19/conf
vi mod-jk.conf
LoadModule jk_module modules/mod_jk.so
JkWorkersFile conf/workers.properties
JkLogFile logs/mod_jk.log
JkLogLevel info
JkMount /sample/* node1
在相同的目录下创建一个名字为workers.properties文件
[root@localhost conf]# vi workers.properties
worker.list=node1
worker.node1.port=8009
worker.node1.host=10.130.240.51
worker.node1.type=ajp13
worker.node1.lbfactor=1
配置文件内容详解:
节点名称:通常是主机的名字
tocmcat接受AJP的端口:默认是8009
tomcat的IP地址
使用的协议
负载均衡的方法
include conf/mod_jk.conf
相比配置mod_jk,mod_proxy稍微简单一些。
LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so
NameVirtualHost *
<VirtualHost *>
ServerName abc.com
ProxyRequests Off
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://localhost:8080/
ProxyPa***everse / http://localhost:8080/
<Location />
Order allow,deny
Allow from all
</Location>
</VirtualHost>
mod_jk和mod_proxy两种方式的对比:
Feature mod_jk mod_proxy
Load balancing High level Basic
Management interface Yes No
Compilation Separate process Not required. By default comes with Apache
Configuration Huge Basic
Protocol AJP HTTP/HTTPS/AJP
Node failure Advance NA
标签:tomcat
原文地址:http://blog.51cto.com/aishangwei/2125058