1、安装Tomcat
- 官网下载
- 解压缩:tar -zxvf apache-tomcat-8.0.32.tar.gz
- 配置server.xml
连接池: <Executor name="tomcatThreadPool" namePrefix="catalina-exec-" maxThreads="500" minSpareThreads="30" prestartminSpareThreads = "true" maxQueueSize = "100" maxIdleTime="60000"/> 连接: <Connector executor="tomcatThreadPool" port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol" connectionTimeout="20000" acceptCount="100" acceptorThreadCount="2" redirectPort="8443" URIEncoding="utf-8"/> 禁用 AJP(如果你服务器没有使用 Apache,我们用的Nginx) <!-- <Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> --> 如果是部署多Tomcat,Connector端口和Server端口要改下,防止端口出现冲突, 各参数详细解释可以参照官网,或者底部的链接
- 配置JVM参数:
cd bin
vim catalina.sh
首行添加如下:
CATALINA_OPTS=‘-server -Xms1024m -Xmx1024m -XX:PermSize=128M -XX:MaxPermSize=256M -XX:+UseParallelOldGC -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -Xloggc:/data/log/posapp/gc.log -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/data/log/posapp/heapdump.bin‘ export JAVA_HOME=/usr/local/jdk1.7.0_79 export JRE_HOME=/usr/local/jdk1.7.0_79/jre
JAVA_OPTS和CATALINA_OPTS稍有不同,最好设置CATALINA_OPTS,关于2者的不同 参见:
https://stackoverflow.com/questions/11222365/catalina-opts-vs-java-opts-what-is-the-difference
2、安装jdk:
- 下载jdk
- 解压缩:tar -zxvf jdk-7u79-linux-x64.tar.gz
- 配置环境变量:
cd /etc
vim profile
#set java environment JAVA_HOME=/usr/local/jdk1.7.0_79 JRE_HOME=/usr/local/jdk1.7.0_79/jre CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar PATH=$JAVA_HOME/bin:$PATH export JAVA_HOME JRE_HOME CLASSPATH PATH
3、安装redis:
- 下载redis
- 解压缩:tar -zxvf redis-3.0.5.tar.gz
- 进入解压缩目录:cd redis-3.0.5
- 编译:make
- 编译安装:make install
- 修改配置文件(守护线程执行、设置登陆凭证) vim redis.conf
aemonize yes
requirepass *****
- 启动: src/redis-server redis.conf
4、参考链接:
时间: 2024-10-04 13:25:59