安装第二个Tomcat完成后,到安装目录下的conf子目录中打开server.xml文件,查找以下三处:
(1) 修改http访问端口(默认为8080端口)
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
把8080改为8081
(2) 修改Shutdown端口(默认为8005端口)
<Server port="8006" shutdown="SHUTDOWN">
把8005改为8006
(3) 修改JVM启动端口(默认为8009端口)
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443"
minProcessors="100" maxProcessors="2000"
maxThreads="2000" minSpareThreads="250" maxSpareThreads="750"
enableLookups="false" acceptCount="2000"
connectionTimeout="20000" disableUploadTimeout="true" debug="0"
/>
把8009改为8010 (上面包括调优)
另外apache下面的也要改一下。(大部分不改)
vi /usr/local/apache/conf/extra/workers.properties
worker.list=loadbalancer
# -----------------------
# Tomcat host 1
# -----------------------
worker.tomcat1.type=ajp13
worker.tomcat1.host=localhost
worker.tomcat1.port=8009
worker.tomcat1.lbfactor=1
# -----------------------
# Tomcat host 2
# -----------------------
worker.tomcat2.type=ajp13
worker.tomcat2.host=localhost
worker.tomcat2.port=8010
worker.tomcat2.lbfactor=1
# -----------------------
# Tomcat host 3
# -----------------------
worker.tomcat3.type=ajp13
worker.tomcat3.host=localhost
worker.tomcat3.port=8011
worker.tomcat3.lbfactor=1
# -----------------------
# LB settings here
# -----------------------
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=tomcat1,tomcat2,tomcat3
调优:
vi /usr/local/tomcat/bin/catalina.sh
JAVA_OPTS=" -Xms1024m -Xmx1024m -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=256m -Djava.awt.headless=true "
# more catalina.sh
(1) 修改http访问端口(默认为8080端口)
<Connector port="8081" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" />
把8080改为8081
(2) 修改Shutdown端口(默认为8005端口)
<Server port="8006" shutdown="SHUTDOWN">
把8005改为8006
(3) 修改JVM启动端口(默认为8009端口)
<Connector port="8010" protocol="AJP/1.3" redirectPort="8443"
minProcessors="100" maxProcessors="2000"
maxThreads="2000" minSpareThreads="250" maxSpareThreads="750"
enableLookups="false" acceptCount="2000"
connectionTimeout="20000" disableUploadTimeout="true" debug="0"
/>
把8009改为8010 (上面包括调优)
另外apache下面的也要改一下。(大部分不改)
vi /usr/local/apache/conf/extra/workers.properties
worker.list=loadbalancer
# -----------------------
# Tomcat host 1
# -----------------------
worker.tomcat1.type=ajp13
worker.tomcat1.host=localhost
worker.tomcat1.port=8009
worker.tomcat1.lbfactor=1
# -----------------------
# Tomcat host 2
# -----------------------
worker.tomcat2.type=ajp13
worker.tomcat2.host=localhost
worker.tomcat2.port=8010
worker.tomcat2.lbfactor=1
# -----------------------
# Tomcat host 3
# -----------------------
worker.tomcat3.type=ajp13
worker.tomcat3.host=localhost
worker.tomcat3.port=8011
worker.tomcat3.lbfactor=1
# -----------------------
# LB settings here
# -----------------------
worker.loadbalancer.type=lb
worker.loadbalancer.balance_workers=tomcat1,tomcat2,tomcat3
调优:
vi /usr/local/tomcat/bin/catalina.sh
JAVA_OPTS=" -Xms1024m -Xmx1024m -XX:PermSize=64M -XX:MaxNewSize=256m -XX:MaxPermSize=256m -Djava.awt.headless=true "
# more catalina.sh