tomcat ????????????
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了tomcat ????????????相关的知识,希望对你有一定的参考价值。
?????????install ??????tomcat ????????? cal template https ?????? ????????? byte
Tomcat ??????????????????????????????
?????????????????????
??????????????????
????????????????????? ???nginx??????
??????????????? ??????tomcat??????
???????????? ??????nginx????????????
JVM????????????
??????????????? /usr/local/tomcat/bin/catalina.sh
CATALINA_OPTS="
server
Xms6000M
Xmx6000M
Xss512k
XX:NewSize=2250M
XX:MaxNewSize=2250M
XX:PermSize=128M
XX:MaxPermSize=256M
XX:+AggressiveOpts
XX:+UseBiasedLocking
XX:+DisableExplicitGC
XX:+UseParNewGC
XX:+UseConcMarkSweepGC
XX:MaxTenuringThreshold=31
XX:+CMSParallelRemarkEnabled
XX:+UseCMSCompactAtFullCollection
XX:LargePageSizeInBytes=128m
XX:+UseFastAccessorMethods
XX:+UseCMSInitiatingOccupancyOnly
Duser.timezone=Asia/Shanghai
Djava.awt.headless=true"
?????????????????????????????????http://blog.51cto.com/zhongliang/2101918
Tomcat ????????????
??????????????????tomcat??????????????????server.xml??????,
??????DNS???????????????????????????????????????
maxThreads???tomcat????????????????????????????????????????????????????????????????????????200
acceptCount??????tomcat??????????????????????????????????????????????????????????????????????????????100
????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
<Connector port="8080"
protocol="org.apache.coyote.http11.Http11NioProtocol"
connectionTimeout="20000" ????????????
redirectPort="8443"
maxThreads="500" ???????????? ?????????????????????
minSpareThreads="20" ?????????????????????
acceptCount="100" ???????????? ???????????????
disableUploadTimeout="true" ?????????Apache??????keeyalive??????
enableLookups="false" ??????DNS??????
URIEncoding="UTF-8" />
maxSpareThreads : ?????????????????????
acceptCount?????????????????????maxThreads?????????????????????????????????????????????????????????acceptCount??????????????????????????????????????????????????????????????????refuse connection
??????compression=???on??? compressionMinSize=???2048??? compressableMimeType=???text/html,text/xml,text/javascript,text/css,text/plain???
????????????
??????DNS??????
???????????????(?????????)
maxThreads="600" ???????????????
minSpareThreads="100" ??????????????????????????????
maxSpareThreads="500" ???????????????????????????????????????Tomcat???????????????????????????socket??????
acceptCount="700" ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
java?????? ????????????????????????
???windows?????????jdk????????????????????????
???c: Program Filesjdkinjconsole.exe ????????????????????????
??????IP:????????????????????????JAVA?????????
???c: Program Filesjdkinjvisualvm.exe
??????IP:???????????? ????????????
???tomcat??????????????????????????????
catalina.sh???????????????,?????????#!/bin/bash?????????
vim /usr/local/tomcat8/bin/catalina.sh
!/bin/bash
CATALINA_OPTS="$CATALINA_OPTS
Djava.rmi.server.hostname=10.204.3.7
Dcom.sun.management.jmxremote
Dcom.sun.management.jmxremote.port=12345
Dcom.sun.management.jmxremote.authenticate=true
Dcom.sun.management.jmxremote.ssl=false
Dcom.sun.management.jmxremote.pwd.file=/usr/local/jdk1.7/jre/lib/management/jmxremote.password"
??????????????????
cd /usr/local/jdk1.7/jre/lib/management/
cp jmxremote.password.template jmxremote.password
vi jmxremote.password
zhongliang 123456 # ?????????zhongliang ??????249765270
chmod 600 jmxremote.password
??????tomcat???????????????????????????12345
??????jconsole???jvisualvm
??????????????????:?????? 10.204.3.7:12345
????????????????????????JMX..????????????10.204.3.7:12345
CPU???????????? ?????????????????? ?????????
???????????????
??????????????????????????????GC???????????????????????????????????????
Zabbix??????tomcat
zabbix????????????????????????--enable-java
yum??????????????????yum install zabbix-java
vim zabbix_server.conf
JavaGateway=192.168.3.14
JavaGatewayPort=10052
StartJavaPollers=5
??????????????????cmdline-jmxclient
http://crawler.archive.org/cmdline-jmxclient/
Apache??????tomcat
??????httpd
??????tomcat
????????????mod_jk???
??????tomcat-connectors-1.2.42-src.tar.gz???
Wget -c https://mirrors.tuna.tsinghua.edu.cn/apache/tomcat/tomcat-connectors/jk/tomcat-connectors-1.2.42-src.tar.gz
tar xzvf tomcat-connectors-1.2.42-src.tar.gz
cd tomcat-connectors-1.2.42/native
./configure --with-apxs=/usr/local/apache2/bin/apxs
make
cp ./apache-2.0/mod_jk.so /usr/local/apache/modules/
?????????
???/usr/local/apache/conf/??????????????????????????????mod_jk.conf???workers.properties???
vi mod_jk.conf#######################
?????????????????????
??????mod_jk????????????????????????????????????workers.properties?????????
JkWorkersFile /usr/local/apache/conf/workers.properties
Where to put jk logs
JkLogFile /usr/local/apache/logs/mod_jk.log
Set the jk log level [debug/error/info]
JkLogLevel info
Select the log format
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkOptions indicate to send SSL KEY SIZE,
JkOptions +ForwardKeySize +ForwardURICompat -ForwardDirectories
JkRequestLogFormat set the request format
JkRequestLogFormat "%w %V %T"
?????????servlet ???jsp????????????ajp13???????????????Tomcat??????Tomcat?????????
JkMount /servlet/* worker1
JkMount /*.jsp worker1
.
vi workers.properties###########################
?????????????????????
Defining a worker named worker1 and of type ajp13
worker.list=worker1
Set properties for worker1
worker.worker1.type=ajp13
worker.worker1.host=localhost
worker.worker1.port=8009
worker.worker1.lbfactor=50
worker.worker1.cachesize=10
worker.worker1.cache_timeout=600
worker.worker1.socket_keepalive=1
worker.worker1.socket_timeout=300
.
??????apache???tomcat
Vim httpd.conf#############
DirectoryIndex index.jsp index.html
??????index.jsp
LoadModule jk_module modules/mod_jk.so
??????mod_jk.so??????
Include /usr/local/apache/conf/mod_jk.conf
??????????????????
???tomcat???apache???????????????????????????????????????????????????index.jsp
Nginx??????Tomcat ??????
T_INSTALL_DIR=/usr/local/tomcat
Port=`export 8005+1`
????????????tomcat???tomcat1 tomcat2 tomcat3
???????????????????????????????????????
??????nginx
tar zxvf nginx-1.7.8.tar.gz //??????
cd nginx-1.7.8
./configure --with-http_stub_status_module --with-http_ssl_module//??????server????????????https??????
make && make install
??????nginx.conf???????????????????????????location
location ~ .(jsp|do)$ {
index index.jsp;
proxy_pass http://192.168.74.129:8081; //??????jsp??????do????????????????????????tomcat??????</span>
proxy_redirect off;
proxy_set_header Host $host; //?????????Web?????????????????????X-Forwarded-For??????????????????IP
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m; //????????????????????????????????????????????????
client_body_buffer_size 128k; //??????????????????????????????????????????????????????
proxy_connect_timeout 90; //nginx????????????????????????????????????
proxy_read_timeout 90; //?????????????????????????????????????????????
proxy_buffer_size 4k; //????????????????????????nginx??????????????????????????????????????????
proxy_buffers 6 32k; //proxy_buffers???????????????????????????32k???????????????????????????
proxy_busy_buffers_size 64k;//???????????????????????????proxy_buffers*2???
proxy_temp_file_write_size 64k; //??????????????????????????????????????????????????????upstream????????????
}
Tomcat??????
????????????
/usr/local/tomcat/logs/catalina.out
????????????tomcat??????????????????????????????????????????????????????????????????
??????????????????????????????????????????????????????????????????????????????
?????????????????????????????????
???????????????????????????????????????????????????????????????????????????ROOT??????????????????????????????????????????
15.1 cannot execute binary file
/usr/local/tomcat8/bin/catalina.sh: line 433: /usr/local/jdk1.8/bin/java: cannot execute binary file
[[email protected] local]# java --version
bash: /usr/local/jdk1.8/bin/java: cannot execute binary file
?????????????????????????????????????????????
15.2 insufficient free space available after evicting expired cache entries-consider increasing the maximum size of the cache.
tomcat??????jenkins???????????????
insufficient free space available after evicting expired cache entries-consider increasing the maximum size of the cache.
??????????????????????????????tomcat/conf/context.xml????????????????????????????????????????????????
<Resources
cachingAllowed="true"
cacheMaxSize="102400"
/>
以上是关于tomcat ????????????的主要内容,如果未能解决你的问题,请参考以下文章
jsp页面被tomcat引擎运行的时候组装成java片段,但是这些java片段怎么没有main方法作为程序的入口啊?