Apache Traffic Server服务搭建
一、简介
二、功能
- 作为一个反向代理
- 作为一个web代理缓存
- 部署在多级缓存
#官网
https://trafficserver.apache.org/
安装环境
yum install 'liblz*' -y
yum install net-tools -y
yum install gcc gcc-c++ glibc-devel -y
yum install autoconf automake pkgconfig libtool -y
yum install perl-ExtUtils-MakeMaker perl-URI.noarch -y
yum install openssl-devel tcl-devel expat-devel -y
yum install pcre pcre-devel zlib-devel xz-devel -y
yum install libcap libcap-devel flex hwloc hwloc-devel -y
yum install lua-devel curl curl-devel sqlite-devel bzip2 -y
1.安装pcre
[root@web_01 pcre-8.36]# wget http://ftp.exim.llorien.org/pcre/pcre-8.36.tar.gz
[root@web_01 pcre-8.36]# tar xf pcre-8.36.tar.gz
[root@web_01 pcre-8.36]# cd pcre-8.36
[root@web_01 pcre-8.36]# ./configure --prefix=/usr/local/trafficserver/pcre
[root@web_01 pcre-8.36]# make && make instal
2.安装trafficserver
[root@web_01 ~]# cd /usr/local/src/
[root@web_01 src]# wget https://mirrors.aliyun.com/apache/trafficserver/trafficserver-5.3.2.tar.bz2
[root@web_01 pcre-8.36]# tar xf trafficserver-5.3.2.tar.bz2
[root@web_01 pcre-8.36]# cd trafficserver-5.3.2
[root@web_01 trafficserver-5.3.2]# ./configure --prefix=/usr/local/trafficserver --with-pcre=/usr/local/trafficserver/pcre --enable-example-plugins --enable-experimental-plugins
[root@web_01 trafficserver-5.3.2]# make && make install
注:--enable-example-plugins --enable-experimental-plugins 这两条指令是为了安装ATS官方集成的插件
[root@web_01 trafficserver-5.3.2]# cd /usr/local/trafficserver/bin/
[root@web_01 bin]# ./trafficserver start
Starting Apache Traffic Server: [ Ok
五、Traffic Server进程管理
[root@localhost ~]# ps aux|grep traffic
root 7469 0.0 0.0 129628 7248 ? Ssl 04:57 0:02 /usr/local/tcacheserver/bin/traffic_cop
176 7472 0.0 0.0 501692 19660 ? Sl 04:57 0:30 /usr/local/tcacheserver/bin/traffic_manager
176 7482 19.8 20.8 15253324 10279168 ? Sl 04:57 118:31 /usr/local/tcacheserver/bin/traffic_server
我们可以看到ATS服务启动了三个进程(traffic_cop、traffic_manager、traffic_server)来服务ats请求,管理,控制、监控系统的健康情况,如下图1所述:

- traffic_server 进程是ATS的事务处理引擎。负责接收和处理协议请求以及从本地缓存或源服务器提供资源。
- traffic_manager进程是用来命令和控制ATS的工具,负责启动、监控以及重新配置端口、统计接口、集群管理以及VIP故障转移。
如果traffic_manager进程检测到traffic_server进程失败,它不仅会立即重启该进程,而且会为所有转入的请求维护一个连接队列。在traffic_server重新启动前的几秒内传入的所有连接将被保存在一个队列,并以FIFO的方式处理,这个连接队列接收任何server故障重启时的连接。
- traffic_top进程监控traffic_server和traffic_manager进程的健康状况。
traffic_top进程通过抓取合成web页面的心跳请求方式周期性地(每分钟若干次)查询traffic_server和traffic_manager进程。如果失败事件发生(如果在超过时间间隔内没有收到请求或者收到错误的请求)traffic_top重启traffic_server和traffic_manager。
#修改records.config文件
#25行
CONFIG proxy.config.http.server_ports STRING 80
#29行
CONFIG proxy.config.http.insert_response_via_str INT 2
#添加
CONFIG proxy.config.log.custom_logs_enabled INT 1
#添加
CONFIG proxy.config.log.xml_config_file STRING logs_xml.config
#添加
CONFIG proxy.config.diags.show_location INT 1 #修改remap.config文件添加如下:
regex_map http://(.*) http://$1 #修改logs_xml.config文件添加如下:
<LogFormat>
<Name = "ats_access_log"/>
<Format = "%<cqtd>/%<cqtt> %<cqhm> \"%<cquuc>\" %<pssc> %<ttms> %<cqhl>
%<psql> %<crc> \"%<chi>\" %<pqsn> \"%<{Referer}cqh>\" \"%<psct>\" \"%<{User-agent}cqh>\"
%<csssc> %<pqsi>"/>
</LogFormat> <LogObject>
<Format = "ats_access_log"/>
<Filename = "access"/>
<Protocols = "http"/>
<RollingEnabled = "3"/>
<RollingIntervalSec = "7200"/>
<RollingSizeMb = "2048"/>
</LogObject> #修改storage.config文件
var/trafficserver 4G #重启服务
[root@controller bin]# pwd
/usr/local/trafficserver/bin
[root@controller bin]# ./trafficserver restart
#测试
[root@controller bin]# curl -vx 127.0.0.1:80 -o /dev/null 'http://news.sohu.com/'
* About to connect() to proxy 127.0.0.1 port 80 (#0)
* Trying 127.0.0.1...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Connected to 127.0.0.1 (127.0.0.1) port 80 (#0)
> GET http://news.sohu.com/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: news.sohu.com
> Accept: */*
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 OK
< Content-Type: text/html;charset=UTF-8
< Content-Length: 170289
< Server: ATS/5.3.2
< Date: Fri, 01 Dec 2017 03:26:44 GMT
< Cache-Control: max-age=120
< X-From-Sohu: X-SRC-Cached
< FSS-Cache: EXPIRED from 9206494.16415464.10543436
< Accept-Ranges: bytes
< FSS-Proxy: Powered by 3308164.4618894.4645016
< Age: 0
< Proxy-Connection: keep-alive
< Via: http/1.1 controller (ApacheTrafficServer/5.3.2 [cSsSfU])
<
{ [data not shown]
100 166k 100 166k 0 0 152k 0 0:00:01 0:00:01 --:--:-- 152k
* Connection #0 to host 127.0.0.1 left intact
查看运行情况:
[root@controller bin]# ./traffic_top

Apache Traffic Server服务搭建的更多相关文章
- 安装ATS(apache traffic server)正向代理
一 traffic server简介 Traffic Server是一种高性能Web代理缓存,可通过在网络边缘缓存频繁访问的信息来提高网络效率和性能.这使内容在物理上更接近最终用户,同时实现更快的交付 ...
- Apache Traffic Server
1. ats 安装 参考:https://docs.trafficserver.apache.org/en/latest/getting-started/index.en.html#installat ...
- Apache Traffic Server 5.3.1公布
本文来源于我在InfoQ中文站翻译的文章,原文地址是:www.infoq.com/cn/news/2015/07/traffic-server-5.3.1-release 近日,Apache软件基金会 ...
- Apache Traffic Server(ats)
零.前言1.官网 http://trafficserver.apache.org/2.国内社区 https://blog.zymlinux.net3.简洁明了的配置:http://blog.csdn. ...
- apache traffic server安装
wget http://mirrors.hust.edu.cn/apache/trafficserver/trafficserver-7.1.1.tar.bz2 tar -jxvf trafficse ...
- ATS (apache traffic server) http_ui 设置与使用
参考官方FAQ进行设置: https://cwiki.apache.org/confluence/display/TS/FAQ#FAQ-http_ui 这里也有一篇: https://blog.zym ...
- Apache HTTP Server 2.2.34安装
Windows 下载 安装方式有自己编译源码和下载别人编译好的,这里选择从第三方下载,官网地址http://mirrors.tuna.tsinghua.edu.cn/apache//httpd/bin ...
- 篇章一:SVN服务搭建【基于Windows server 2008R2 + Windows7】
1.软件下载 1.1 软件介绍 Subversion是优秀的版本控制工具,其具体的的优点和详细介绍,这里就不再多说. 首先来下载和搭建SVN服务器. 现在Subversion已经迁移到apache网站 ...
- 【阿里云】在 Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务
Windows Server 2016 下使用 FileZilla Server 安装搭建 FTP 服务 一.安装 Filezilla Server 下载最新版本的 Filezilla Server ...
随机推荐
- 【转载】从头编写 asp.net core 2.0 web api 基础框架 (4) EF配置
Github源码地址:https://github.com/solenovex/Building-asp.net-core-2-web-api-starter-template-from-scratc ...
- uImage和zImage的区别
1.各种文件的意义 vmlinux 编译出来的最原始的内核文件,未压缩. zImage 是vmlinux经过gzip压缩后的文件. bzImage bz表示“big zImage”,不是用bzi ...
- [linux] C语言Linux系统编程-TCP通信的11种状态
三次握手由client主动发出SYN请求, 此时client处于SYN_SENT状态(第一次握手)当server收到之后会由LISTEN转变为SYN_REVD状态, 并回复client, client ...
- MyBatis + MySQL返回插入的主键id
这是最近在实现perfect-ssm中的一个功能时碰到的一个小问题,觉得需要记录一下,向MySQL数据库中插入一条记录后,需要获取此条记录的id值,以生成对应的key值存入到redis中,id为自增i ...
- 云计算之路-阿里云上:docker swarm 集群故障与异常
在上次遭遇 docker swarm 集群故障后,我们将 docker 由 17.10.0-ce 升级为最新稳定版 docker 17.12.0-ce . 前天晚上22:00之后集群中的2个节点突然出 ...
- CSS清除浮动的几种方式
浮动对页面的影响: 如果一个父盒子中有一个子盒子,并且父盒子没有设置高,子盒子在父盒子中进行了浮动,那么将来父盒子的高度为0.由于父盒子的高度为0, 下面的元素会自动补位,所以这个时候要进行浮动的清除 ...
- 【margin和padding的区别】
margin和padding的区别 margin是指从自身边框到另一个容器边框之间的距离,就是容器外距离.(外边距) padding是指自身边框到自身内部另一个容器边框之间的距离,就是容器内距离.(内 ...
- Codeforces 626G Raffles(贪心+线段树)
G. Raffles time limit per test:5 seconds memory limit per test:256 megabytes input:standard input ou ...
- Vijos P1497 立体图【模拟】
立体图 描述 小渊是个聪明的孩子,他经常会给周围的小朋友们讲些自己认为有趣的内容.最近,他准备给小朋友讲解立体图,请你帮他画出立体图. 小渊有一块面积为m*n的矩形区域,上面有m*n个边长为1的格子, ...
- UEP-弹窗
注意:弹出窗口Action中的dataWrap属性要加上set方法 默认情况下为GET方式传递参数,此方法对参数的长度有限制,若是长度超过范围的话请使用POST方式 function testPopW ...