五、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
转载于:https://www.cnblogs.com/Dev0ps/p/7891659.html
相关资源:Apache traffic server 离线一键安装脚本