1. 安裝環境... 4javascript
2. 安裝步驟... 5css
2.1. 安裝JDK.. 5html
2.2. 安裝tomcat 5java
3. 安裝標準... 6web
3.1. 程序安裝目錄... 6apache
3.2. 日誌路徑: 6tomcat
3.3. 啓動腳本... 6服務器
3.4. 配置文件... 7app
3.5. 虛擬主機配置... 8webapp
3.6. 重啓腳本... 8
1.安裝環境
OS: Linux
Tomcat: 6.0.24
JDK: sun jdk 1.6.0_27
2.安裝步驟
2.1.安裝JDK
參見
http://wiki.tomshopping.com/pages/viewpage.action?pageId=14288188
2.2.安裝tomcat
# cd /data/postmall/steve
# wget http://archive.apache.org/dist/tomcat/tomcat-6/v6.0.24/bin/apache-tomcat-6.0.24.tar.gz
# tar zxvf apache-tomcat-6.0.24.tar.gz
# cd /usr/local
# cp -r /data/postmall/steve/apache-tomcat-6.0.24 tomcat1
# cp -r /data/postmall/steve/apache-tomcat-6.0.24 tomcat2
# cp -r /data/postmall/steve/apache-tomcat-6.0.24 tomcat3
# chown -R web.users /usr/local/tomcat*
# chown -R web.users /data/logs/tomcat
# chown -R web.users /data/postmall/tomcat
3.安裝標準
郵樂平臺因爲模塊不少,須要不少容器來部署,爲簡化部署流程,節約硬件資源,缺省每臺服務器最多安裝3個tomcat, 即TOMCAT1, TOMCAT2, TOMCAT3, 便於區分辨認。
3.1.程序安裝目錄
TOMCAT1: /usr/local/tomcat1
TOMCAT2: /usr/local/tomcat2
TOMCAT3: /usr/local/tomcat3
3.2.日誌路徑:
TOMCAT1: /data/logs/tomcat/catalina8080.out.%Y%m%d (尾數是年月日)
TOMCAT2: /data/logs/tomcat/catalina9090.out.%Y%m%d (尾數是年月日)
TOMCAT3: /data/logs/tomcat/catalina7070.out.%Y%m%d (尾數是年月日)
3.3. 啓動腳本
須要對 /usr/local/tomcat1/bin/catalina.sh 作以下修改:
增長如下部分
export LANG="en_US.UTF-8"
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
export JAVA_HOME=/usr/local/jdk
修改 JAVA_OPTS
JAVA_OPTS="$JAVA_OPTS -server -Xss128k -Xmx1536m -Xms512m -XX:MaxNewSize=256m -XX:MaxPermSize=512m -Dsun.lang.ClassLoader.allowArraySyntax=true "
修改日誌輸出
TOMCAT1:
2>&1 |/usr/sbin/rotatelogs /data/logs/tomcat/catalina8080.out.%Y%m%d 86400 480 &
# >> "$CATALINA_BASE"/logs/catalina.out 2>&1 & (此行註釋)
TOMCAT2:
2>&1 |/usr/sbin/rotatelogs /data/logs/tomcat/catalina9090.out.%Y%m%d 86400 480 &
# >> "$CATALINA_BASE"/logs/catalina.out 2>&1 & (此行註釋)
TOMCAT3:
2>&1 |/usr/sbin/rotatelogs /data/logs/tomcat/catalina7070.out.%Y%m%d 86400 480 &
# >> "$CATALINA_BASE"/logs/catalina.out 2>&1 & (此行註釋)
確保/usr/sbin/rotatelogs文件存在。(debian是/usr/sbin/rotatelogs, suse是/usr/sbin/rotatelogs2),沒有的話須要安裝相應模塊。
3.4. 配置文件
TOMCAT1: /usr/local/tomcat1/conf/server.xml
Server port="8005"
Connector port="8080"
<Connector port="8009" maxHttpHeaderSize="8192" maxThreads="8192" minSpareThreads="256" maxSpareThreads="1024" acceptCount="2048" connectionTimeout="20000" enableLookups="false" compression="on" compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css" redirectPort="8443" protocol="AJP/1.3" URIEncoding="UTF-8" packetSize="65536" />
TOMCAT2: /usr/local/tomcat1/conf/server.xml
Server port="9005"
Connector port="9090"
<Connector port="9009" maxHttpHeaderSize="8192" maxThreads="8192" minSpareThreads="256" maxSpareThreads="1024" acceptCount="2048" connectionTimeout="20000" enableLookups="false" compression="on" compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css" redirectPort="9443" protocol="AJP/1.3" URIEncoding="UTF-8" packetSize="65536" />
TOMCAT3: /usr/local/tomcat1/conf/server.xml
Server port="7005"
Connector port="7070"
<Connector port="7009" maxHttpHeaderSize="8192" maxThreads="8192" minSpareThreads="256" maxSpareThreads="1024" acceptCount="2048" connectionTimeout="20000" enableLookups="false" compression="on" compressableMimeType="text/html,text/xml,text/plain,text/javascript,text/css" redirectPort="7443" protocol="AJP/1.3" URIEncoding="UTF-8" packetSize="65536" />
3.5.虛擬主機配置
<Host name="search.ulecn.tom.com" appBase="/data/postmall/tomcat/webapps_sphinxPostSearch" unpackWARs="true" autoDeploy="true" xmlValidation="false" xmlNamespaceAware="false">
</Host>
3.6.重啓腳本
TOMCAT1: ~/t1_restart.sh
TOMCAT2: ~/t2_restart.sh
TOMCAT3: ~/t3_restart.sh