tomcat APR模式配置

一、环境

操作系统:Ubutnu 14

ubuntu@ubuntu:~$ uname -a
Linux ubuntu 4.4.0-31-generic #50~14.04.1-Ubuntu SMP Wed Jul 13 01:07:32 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

JDK 1.8

ubuntu@ubuntu:~$ java -version
java version "1.8.0_141"
Java(TM) SE Runtime Environment (build 1.8.0_141-b15)
Java HotSpot(TM) 64-Bit Server VM (build 25.141-b15, mixed mode)
ubuntu@ubuntu:~$ whereis java
java: /usr/local/java /usr/share/java

Tomcat 8.5.35

root@ubuntu:~# /var/www/demo/bin/version.sh
Using CATALINA_BASE: /var/www/demo
Using CATALINA_HOME: /var/www/demo
Using CATALINA_TMPDIR: /var/www/demo/temp
Using JRE_HOME: /usr/local/java/jre
Using CLASSPATH: /var/www/demo/bin/bootstrap.jar:/var/www/demo/bin/tomcat-juli.jar
Server version: Apache Tomcat/8.5.35
Server built: Nov 3 2018 17:39:20 UTC
Server number: 8.5.35.0
OS Name: Linux
OS Version: 4.4.0-31-generic
Architecture: amd64
JVM Version: 1.8.0_141-b15
JVM Vendor: Oracle Corporation

二、安装

1. 安装编译需要的环境

$ sudo apt install gcc make

2. 安装 native 编译所需要的依赖包

# apache apr
$ sudo apt install libapr1-dev
# openssl,自带的 openssl版本较低,需要编译安装
$ wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz
$ sudo mkdir /usr/local/openssl
$ tar zxf openssl-1.1.1a.tar.gz
$ ./config --prefix=/usr/local/openssl
$ make
$ sudo make install

3.下载安装native

$ wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-connectors/native/1.2.19/source/tomcat-native-1.2.19-src.tar.gz
$ cd tomcat-native-1.2.19-src/native/
$ ./configure --with-ssl=/usr/local/openssl
$ make
$ sudo make install

三、配置Tomcat

root@ubuntu:/var/www/demo# cat bin/setenv.sh
export JAVA_OPTS="$JAVA_OPTS -Djava.library.path=/usr/local/apr/lib"

<Connector port="8080"
protocol="org.apache.coyote.http11.Http11AprProtocol"
connectionTimeout="20000"
redirectPort="8443" />
...
<!--<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" /> -->

四、启动Tomcat

root@ubuntu:/var/www/demo# bin/catalina.sh run
.....
28-Jan-2019 15:55:09.140 INFO [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/var/www/demo/webapps/docs] has finished in [13] ms
28-Jan-2019 15:55:09.153 INFO [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-apr-8080"]
28-Jan-2019 15:55:09.172 INFO [main] org.apache.catalina.startup.Catalina.start Server startup in 803 ms

附:编译方式安装apr

1. 安装编译需要的环境

$ sudo apt install -y gcc make  libtool  libexpat1-dev

2. 安装Apache Portable Runtime (apr)

官方地址:https://apr.apache.org/compiling_unix.html

编译安装apr

wget http://mirrors.shu.edu.cn/apache//apr/apr-1.6.5.tar.gz
tar zxf apr-1.6.5.tar.gz
cd apr-1.6.5/
./configure --prefix=/usr/local/apache-apr
make
sudo make install

编译安装apr-iconv

wget http://mirrors.shu.edu.cn/apache//apr/apr-iconv-1.2.2.tar.gz
tar zxf apr-iconv-1.2.2.tar.gz
cd apr-iconv-1.2.2/
./configure --prefix=/usr/local/apache-apr-iconv --with-apr=/usr/local/apache-apr
make
sudo make install

编译安装apr-util

wget http://mirrors.shu.edu.cn/apache//apr/apr-util-1.6.1.tar.gz
ubuntu@ubuntu:~/apr-util-1.6.1$ ./configure --prefix=/usr/local/apache-apr-util --with-apr=/usr/local/apache-apr --with-apr-iconv=/usr/local/apache-apr-iconv/bin/apriconv
tar zxf apr-util-1.6.1.tar.gz
cd apr-util-1.6.1/
make
sudo make install

3. 编译安装openssl

wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz
$ sudo mkdir /usr/local/openssl
$ tar zxf openssl-1.1.1a.tar.gz
$ ./config --prefix=/usr/local/openssl
cd openssl-1.1.1a
$ make
$ sudo make install

4. 编译安装native

wget http://mirrors.hust.edu.cn/apache/tomcat/tomcat-connectors/native/1.2.19/source/tomcat-native-1.2.19-src.tar.gz
tar zxf tomcat-native-1.2.19-src.tar.gz
$ cd tomcat-native-1.2.19-src/native/
$ ./configure --prefix=/usr/local/native --with-ssl=/usr/local/openssl --with-apr=/usr/local/apache-apr/bin/apr-1-config
$ make
$ sudo make install

Tomcat 8.5 apr 模式配置的更多相关文章

  1. tomcat bio nio apr 模式性能测试

    转自:tomcat bio nio apr 模式性能测试与个人看法 11.11活动当天,服务器负载过大,导致部分页面出现了不可访问的状态.那后来主管就要求调优了,下面是tomcat bio.nio.a ...

  2. Spring Boot切换为APR模式

    Spring Boot内置了tomcat容器,直接运行Application就可以启动web服务器. 在tomcat中提供了三种方式:BIO.NIO.APR. BIO tomcat7以下的版本都是BI ...

  3. Tomcat在Linux服务器上的BIO、NIO、APR模式设置

    一.BIO.NIO.AIO 先了解四个概念: 同步 : 自己亲自出马持银行卡到银行取钱(使用同步IO时,Java自己处理IO读写). 异步 : 委托一小弟拿银行卡到银行取钱,然后给你(使用异步IO时, ...

  4. Tomcat8 配置APR模式

    首先说明下tomcat connector运行的3中模式及区别: 1)bio 默认的模式,同步阻塞,性能非常低下,没有经过任何优化处理和支持. 2)nio  同步非阻塞,利用java的异步io护理技术 ...

  5. springboot使用tomcat apr模式

    因需项目对并发要求比较高.提高Tomcat效率.使用tomcat apr模式.今天在这记录下使用过程.apr全称为apache portable runtime.这里套用下wiki对apr的解释. T ...

  6. SpringBoot内嵌Tomcat开启APR模式(运行环境为Centos7)

    网上查到的一些springboot内嵌的tomcat开启apr的文章,好像使用的springboot版本较老,在SpringBoot 2.0.4.RELEASE中已经行不通了.自己整理了一下,供参考. ...

  7. tomcat优化之安装并配置apr库

    在谈到tomcat优化时,必然要说到apr库,这个库是C语言实现的,tomcat通过JNI方式使用该库可以大大提高性能. tomcat在使用apr时需要安装apr,apr-util和tomcat-na ...

  8. tomcat APR的配置

    Tomcat 可以使用 APR 来提供超强的可伸缩性和性能,更好地集成本地服务器技术. APR(Apache Portable Runtime) 是一个高可移植库,它是 Apache HTTP Ser ...

  9. TOMCAT开启APR模式

    Tomcat支持三种接收请求的处理方式:BIO.NIO.ARP. BIO模式:阻塞式I/O操作,表示Tomcat使用传统Java I/O操作.默认情况下,Tomcat7以下版本使用BIO模式运行,由于 ...

随机推荐

  1. 【leetcode】1123. Lowest Common Ancestor of Deepest Leaves

    题目如下: Given a rooted binary tree, return the lowest common ancestor of its deepest leaves. Recall th ...

  2. 对npm的认识

    npm由三个不同的组件组成:1,网站 2.命令行界面(CLI)3.注册表 需要在网站注册 命令行界面用来进行交互 注册表来进行保存 安装本地软件包 npm install 包名 更新本地软件包 npm ...

  3. vue引入css和js的方法

    1.引入js的话 require('地址') imgport xxx from ‘src’ import xxx 2.引入css @import ‘  ’

  4. Vuex-全局状态管理【传递参数】

    src根目录 新建store文件夹,新建index.js 作为入口 在store文件夹中 新建modules文件夹 modules文件夹中,新建 a.js b.js 2个文件 a.js const s ...

  5. jQuery ajax - ajaxSetup() 方法

    实例 为所有 AJAX 请求设置默认 URL 和 success 函数: $("button").click(function(){ $.ajaxSetup({url:" ...

  6. php大文件上传解决方案

    PHP用超级全局变量数组$_FILES来记录文件上传相关信息的. 1.file_uploads=on/off 是否允许通过http方式上传文件 2.max_execution_time=30 允许脚本 ...

  7. 把图片画到画布上,适应PC和移动端

    画一张图片到画布上 <canvas id="myCanvas" width="1000px" height="200px" >您 ...

  8. POJ 1380 Equipment Box (暴力枚举)

    Equipment Box 题目链接: http://acm.hust.edu.cn/vjudge/contest/130510#problem/B Description There is a la ...

  9. 手把手教你做echarts图表系列之组织结构图

    在实际项目中使用echarts越来越多了,今天从一个组织结构图开始,手把手教大家开发echarts图表. 公司里的组织结构图如下: 可以参考echarts入门教程:http://echarts.bai ...

  10. jvm监测

    jvm调优,首先,你得会jvm性能检测.开方得先诊断啊.