安装apr来提高Tomcat 的可伸缩性和性能(针对Tomcat7)
cd /root/install-lib/
下载apr 和 apr-util最新版
1 wget http://apache.fayea.com/apr/apr-1.7.0.tar.gz 2 wget http://archive.apache.org/dist/apr/apr-util-1.5.2.tar.gz
解压文件
1 tar -zxvf apr-1.7.0.tar.gz 2 tar -zxvf apr-util-1.5.2.tar.gz
安装apr和apr-util
1 cd apr-1.7.0 2 3 ./configure --prefix=/usr/local/apr 4 5 make 6 7 make install 8 9 cd .. 10 11 cd apr-util-1.5.2 12 13 ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr 14 15 make 16 17 make insatll
安装 tomcat-native
1 cd /usr/local/tomcat/bin 2 tar -zxvf tomcat-native.tar.gz 3 cd tomcat-native-1.1.29-src/native 4 ./configure --with-apr=/usr/local/apr --with-java- home=/usr/java/jdk1.8.0_201-amd64 5 make 6 make install
设置 apr 的环境变量
1 vi /etc/profile 2 3 #在文本的最后面添加以下内容 4 5 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib 6 7 #使profile生效, 8 9 source /etc/profile
启动tomcat并查看catalina.out
1 ./startup.sh 2 3 cat catalina.out
出现 :
org.apache.catalina.core.AprLifecycleListener.init Loaded APR based Apache Tomcat Native library 1.1.29 using APR version 1.5.0.