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 ...
随机推荐
- 原生js选项卡
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- Centos搭建Docker环境
安装Docker 安装Docker Docker 软件包已经包括在默认的 CentOS-Extras 软件源里.因此想要安装 docker,只需要运行下面的 yum 命令: yum install d ...
- datalist标签小结
在Web设计中,经常会用到如输入框的自动下拉提示,这将大大方便用户的输入.在以前,如果要实现这样的功能,必须要求开发者使用一些Javascript的技巧或相关的框架进行ajax调用,需要一定的编程工作 ...
- jQuery实现跨域请求实例
首先准备两个项目做测试(jsonp1,jsonp2) 一:在jsonp1中做一个用于测试的链接 def ajax(request): callbacks = request.GET.get(" ...
- python2与python3的区别 ,小数据池 bytes 类型
一.python2和3的区别 在python3中 在python2中 print('ab')方式打印内容()括号是必须要有的. print 'ab' 可以加可以不加. 只有range 有ran ...
- Progressive Web Applications
Progressive Web Applications take advantage of new technologies to bring the best of mobile sites an ...
- Gym100971B Gym100971C Gym100971F Gym100971G Gym100971K Gym100971L(都是好写的题。。。) IX Samara Regional Intercollegiate Programming Contest Russia, Samara, March 13, 2016
昨天训练打的Gym,今天写题解. Gym100971B 这个题就是输出的时候有点小问题,其他的都很简单. 总之,emnnn,简单题. 代码: #include<iostream> #inc ...
- Linux编译安装Mariadb数据库
一.安装cmake cd /usr/local/src tar zxvf cmake-2.8.12.1.tar.gz cd cmake-2.8.12.1 ./configure 注意报错需要安装gcc ...
- 从parcel.js打包出错,到拥抱nvm
去年年底发布的parcel.js在年底可谓是火了一把,短短一个多月的时间在GitHub热门排行榜上名列前茅.因其几乎零配置的易用性,相比Webpack的复杂配置收获了大量关注及好评,甚至有人预言未来大 ...
- class not found: org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
用jdk1.8版本配完SSH框架后,进行数据库的Hibernate reverse engineering后,,最下面的log.error会报错,然后看网上说是因为jdk1.8,换成了1.7就好了(剩 ...