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 ...
随机推荐
- H5+Ajax+WebApi实现文件下载(进度条,多文件)
前言 踩过的坑 1.WebAPI跨域 2.Jquery ajax低版本不支持XHR 2功能 3.Jquery ajax不支持Deferred的process事件 4.IE下文件名乱码问题 功能实现 & ...
- 接口测试——Java + TestNG 国家气象局接口(json解析)实例
后端测试,主要以测试接口为主.需要代码支撑,近期便找了个天气接口捣鼓了. 使用到的工具是:Eclipse + TestNG + Maven + ReportNG,全国城市编码:http://www.c ...
- 2017ICPC/广西邀请赛1005(水)HDU6186
CS Course Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total S ...
- string::npos的一些说明
一.定义 std:: string ::npos的定义: static const size_t npos = -1; 表示 size_t 的最大值( Maximum value for size_t ...
- B. Gerald is into Art
B. Gerald is into Art time limit per test 2 seconds memory limit per test 256 megabytes input standa ...
- c语言基础学习08_内存管理
=============================================================================涉及到的知识点有:一.内存管理.作用域.自动变 ...
- 10个html5增加的重要新特性和内容
文章开篇之前我们先了解一下什么是html5,百度上是这样定义html5的:万维网的核心语言.标准通用标记语言下的一个应用超文本标记语言(HTML)的第五次重大修改. 其实说白了html5也就是人为定义 ...
- 【自制工具类】Java删除字符串中的元素
这几天做项目需要把多个item的id存储到一个字符串中,保存进数据库.保存倒是简单,只需要判断之前是否为空,如果空就直接添加,非空则拼接个"," 所以这个字符串的数据结构是这样的 ...
- API接口签名验证2
http://www.jianshu.com/p/d47da77b6419 系统从外部获取数据时,通常采用API接口调用的方式来实现.请求方和�接口提供方之间的通信过程,有这几个问题需要考虑: 1.请 ...
- Linux/Unix系统SSH远程按Backspace键删除时出现^H的处理方法
在linux/unix系统中连接SSH远程工作时,输出字符后按Backspace键删除时,会出现^H,这对习惯了按Backspace键删除的用户来说,感觉非常别扭,虽然可以通过Ctrl+Backspa ...