Starting Jetty: 2013-06-18 14:51:22.069:INFO::Redirecting stderr/stdout to /usr/local/jetty-distribution-8.1.11.v20130520/logs/2013_06_18.stderrout.log
OK Tue Jun 18 14:51:25 CST 2013
SESSION ID:1p8k3p99jj7sv1gfw08w6ppl6e
Session serviced by jetty_b
Session created time is :1371538594898
为了增加ajp的支持,确认 $JETTY_HOME/etc/jetty-ajp.xml 文件内容是:
#===========================================================
# Jetty start.jar arguments
# Each line of this file is prepended to the command line
# arguments # of a call to:
# java -jar start.jar [arg...]
#===========================================================
#===========================================================
# If the arguements in this file include JVM arguments
# (eg -Xmx512m) or JVM System properties (eg com.sun.???),
# then these will not take affect unless the --exec
# parameter is included or if the output from --dry-run
# is executed like:
# eval $(java -jar start.jar --dry-run)
#
# Below are some recommended options for Sun's JRE
#-----------------------------------------------------------
# --exec
# -Dorg.apache.jasper.compiler.disablejsr199=true
# -Dcom.sun.management.jmxremote
# -Dorg.eclipse.jetty.util.log.IGNORED=true
# -Dorg.eclipse.jetty.LEVEL=DEBUG
# -Dorg.eclipse.jetty.util.log.stderr.SOURCE=true
# -Xmx2000m
# -Xmn512m
# -verbose:gc
# -XX:+PrintGCDateStamps
# -XX:+PrintGCTimeStamps
# -XX:+PrintGCDetails
# -XX:+PrintTenuringDistribution
# -XX:+PrintCommandLineFlags
# -XX:+DisableExplicitGC
# -XX:+UseConcMarkSweepGC
# -XX:ParallelCMSThreads=2
# -XX:+CMSClassUnloadingEnabled
# -XX:+UseCMSCompactAtFullCollection
# -XX:CMSInitiatingOccupancyFraction=80
#-----------------------------------------------------------
#===========================================================
# Start classpath OPTIONS.
# These control what classes are on the classpath
# for a full listing do
# java -jar start.jar --list-options
#-----------------------------------------------------------
OPTIONS=Server,jsp,jmx,resources,websocket,ext,plus,annotations,ajp
#-----------------------------------------------------------
#===========================================================
# Configuration files.
# For a full list of available configuration files do
# java -jar start.jar --help
#-----------------------------------------------------------
#etc/jetty-jmx.xml
etc/jetty.xml
etc/jetty-annotations.xml
# etc/jetty-ssl.xml
# etc/jetty-requestlog.xml
etc/jetty-deploy.xml
#etc/jetty-overlay.xml
etc/jetty-webapps.xml
etc/jetty-contexts.xml
etc/jetty-testrealm.xml
etc/jetty-ajp.xml
#===========================================================
services jetty restart 重启jetty
复制以上所有操作到另外一台机器的操作系统上,我的集群环境是 centos6.4 x64 xen下的,克隆机器还算简单,网卡被换掉,IP会通过dhcp再获得。
可以将index.jsp中 jetty_a 替换成jetty_b jetty_c等,用于识别后面的负载均衡是否起作用的。
第二阶段,配置tomcat httpd的负载均衡
centos下安装httpd为
yum install httpd
vim /etc/httpd/conf/httpd.conf
在末尾添加:
ProxyPassReverse / balancer://cluster/
# 此指令使Apache调整HTTP重定向应答中Location, Content-Location,URI头里的URL。
# 这样可以避免在Apache作为反向代理使用时,后端服务器的HTTP重定向造成的绕过反向代理的问题。
# The ProxyRequests directive should usually be set off when using ProxyPass.
ProxyRequests Off
# 不允许作为正向代理
ProxyPreserveHost On
# 当启用时,此选项将把传入请求的"Host:"行传递给被代理的主机,而不是传递在ProxyPass中指定的主机名。