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 ...
随机推荐
- xss框架基础框架实现
0x00web服务器设计 (1)tornado处理请求和Application类要编写一个Tornado应用中最多的工作是定义类继承Tornado的RequestHandler类,主要用于将特定的ur ...
- Solidity 中文文档 —— 第一章:Introduction to Smart Contracts
第一章:智能合约简介 粗略地翻译了 Ethereum 的智能合约开发语言的文档:Solidity.欢迎转载,注明出处. 有任何问题请联系我,本人微信:wx1076869692,更多详情见文末. 我是 ...
- 【Html5】-- 塔台管制
想做这个游戏已久,今天终于初步完成,先解释下,这是一个模拟机场塔台管制指挥的游戏,飞机从不同的方向飞入管制空域,有不同的目的地,飞机名称最后一个字母表示飞机要到达的目的地,分ABCD和R.A-D表示四 ...
- 51nod:1689 逛街
原题链接:https://www.51nod.com/onlineJudge/questionCode.html#!problemId=1689 一开始想枚举逛街的终点,然后开两个大根堆维护b值,分别 ...
- 2017多校第一套&&hdu6038 思维 数学
链接 http://acm.hdu.edu.cn/showproblem.php?pid=6038 题意: 给你一个a序列,代表0到n-1的排列:一个b序列代表0到m-1的排列.问你可以找出多少种函 ...
- '<<' '|' '>>' 等位运算符 课本祥解
a<<1 相当于a*2 a>>1 相当于a/2 a<<|1 相当于a*2+1 一些算法用得到.
- 详解:Python2中的urllib、urllib2与Python3中的urllib以及第三方模块requests
在python2中,urllib和urllib2都是接受URL请求的相关模块,但是提供了不同的功能.两个最显著的不同如下: 1.urllib2可以接受一个Request类的实例来设置URL请求的hea ...
- LINUX服务器--所有用户登陆操作命令审计
Linux用户操作记录我们都可以通过命令history来查看历史记录,但是如果因为某人误操作了删除了重要的数据,那么Linux history命令就基本上不会有太大的作用了.我们怎么来查看Linux用 ...
- spring boot容器启动详解
目录 一.前言 二.容器启动 三.总结 =======正文分割线====== 一.前言 spring cloud大行其道的当下,如果不了解基本原理那么是很纠结的(看见的都是约定大于配置,但是原理呢?为 ...
- JSP内置对象1(request,response,session)
request对象 response对象:请求重定向与请求转发的区别. session对象:表示客户端与服务器的一次会话,也就是用户浏览网站所花费的时间.在服务器的内存中保存着不同用户的session ...