收藏 分销(赏)

Tomcat-centos安装以及部署指南.doc

上传人:xrp****65 文档编号:6705169 上传时间:2024-12-20 格式:DOC 页数:5 大小:19.29KB 下载积分:10 金币
下载 相关 举报
Tomcat-centos安装以及部署指南.doc_第1页
第1页 / 共5页
Tomcat-centos安装以及部署指南.doc_第2页
第2页 / 共5页


点击查看更多>>
资源描述
第一步:环境准备 1. 安装JDK, 我安装的是:jdk1.6.0_35;安装路径位于/opt目录下,用root权限进行安装,为了方便管理,后续的软件均安装在/opt目录下; 2. 下载tomcat安装包,我下载的版本是:apache-tomcat-6.0.35.tar.gz 3. 为提升性能,安装APR:Apache Portable Runtime (APR) based Native library for Tomcat: APR support requires three main native components to be installed: · APR library · JNI wrappers for APR used by Tomcat (libtcnative) · OpenSSL libraries 系统安装openssl库没问题,但在centos下系统安装apr时,安装路径有时不在一个目录下,会导致native库无法编译,因此有时需要手动安装apr,apr-util; 从apache网站下载apr,apr-util等源码包,解压至/opt目录下; apr-1.4.6 apr-util-1.4.1 先安装APR: ./configure --prefix=/opt/apr; make make install; 安装apr-util: ./configure --with-apr=/opt/apr --prefix=/opt/apr; make make install; 设置环境变量: LD_LIBRARY_PATH=/opt/apr/lib:$LD_LIBRARY_PATH export LD_LIBRARY_PATH 如不设置环境变量,后续启动tomcat时,会报告找不到apr库的错误; 安装native: ./configure --with-apr=/opt/apr --prefix=/opt/apr make; make install; 设置动态库路径:libtool --finish /opt/apr/lib 4. 不需要修改配置文件,直接启动tomcat,如果发现如下信息提示,则表示tomcat apr安装成功; 2012-9-28 11:35:25 org.apache.catalina.core.AprLifecycleListener init 信息: Loaded APR based Apache Tomcat Native library 1.1.22. 2012-9-28 11:35:25 org.apache.catalina.core.AprLifecycleListener init 信息: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 2012-9-28 11:35:25 org.apache.coyote.http11.Http11AprProtocol init 信息:Initializing Coyote HTTP/1.1 on http-8080 5. APR的相关设置可以参考: http://tomcat.apache.org/tomcat-6.0-doc/apr.html#APR_Connectors_Configuration When APR is enabled, the HTTP connector will use sendfile for handling large static files (all such files will be sent asynchronously using high performance kernel level calls), and will use a socket poller for keepalive, increasing scalability of the server. When APR is enabled, the HTTPS connector will use a socket poller for keepalive, increasing scalability of the server. It also uses OpenSSL, which may be more optimized than JSSE depending on the processor being used, and can be complemented with many commercial accelerator components. Unlike the HTTP connector, the HTTPS connector cannot use sendfile to optimize static file processing. When APR is enabled, the AJP connector will use a socket poller for keepalive, increasing scalability of the server. As AJP is designed around a pool of persistent (or almost persistent) connections, this will reduce significantly the amount of processing threads needed by Tomcat. Unlike the HTTP connector, the AJP connector cannot use sendfile to optimize static file processing. 6. 方便管理,可以在conf/tomcat-user.xml文件中增加一个管理账号: <role rolename="manager-gui"/> <user username="tomcat" password="s3cret" roles="manager-gui"/> 7. 使用APR提高Tomcat性能Tomcat可以使用APR来提供超强的可伸缩性和性能,更好地集成本地服务器技术.  APR(Apache Portable Runtime)是一个高可移植库,它是Apache HTTP Server 2.x的核心。APR有很多用途,包括访问高级IO功能(例如sendfile,epoll和OpenSSL),OS级别功能(随机数生成,系统状态等等),本地进程管理(共享内存,NT管道和UNIX sockets)。这些功能可以使Tomcat作为一个通常的前台WEB服务器,能更好地和其它本地web技术集成,总体上让Java更有效率作为一个高性能web服务器平台而不是简单作为后台容器。 在产品环境中,特别是直接使用Tomcat做WEB服务器的时候,应该使用Tomcat Native来提高其性能 要测APR给tomcat带来的好处最好的方法是在慢速网络上(模拟Internet),将Tomcat线程数开到300以上的水平,然后模拟一大堆并发请求。如果不配APR,基本上300个线程狠快就会用满,以后的请求就只好等待。但是配上APR之后,并发的线程数量明显下降,从原来的300可能会马上下降到只有几十,新的请求会毫无阻塞的进来。 在局域网环境测,就算是400个并发,也是一瞬间就处理/传输完毕,但是在真实的Internet环境下,页面处理时间只占0.1%都不到,绝大部分时间都用来页面传输。如果不用APR,一个线程同一时间只能处理一个用户,势必会造成阻塞。所以生产环境下用apr是非常必要的。 8.
展开阅读全文

开通  VIP会员、SVIP会员  优惠大
下载10份以上建议开通VIP会员
下载20份以上建议开通SVIP会员


开通VIP      成为共赢上传

当前位置:首页 > 包罗万象 > 大杂烩

移动网页_全站_页脚广告1

关于我们      便捷服务       自信AI       AI导航        抽奖活动

©2010-2026 宁波自信网络信息技术有限公司  版权所有

客服电话:0574-28810668  投诉电话:18658249818

gongan.png浙公网安备33021202000488号   

icp.png浙ICP备2021020529号-1  |  浙B2-20240490  

关注我们 :微信公众号    抖音    微博    LOFTER 

客服