Install the ATS 5.3 lts version on the CentOS 6.3 64bit and test

Source: Internet
Author: User
Tags bz2 curl system log centos install perl
Since ATS 5.3 is the latest version of LTS that the community has just launched, it has changed considerably over the previous version, so I decided to abandon my previous experience and explore the version from scratch. Here is a transcript of my groping.

1. Download the source code
Cd/usr/local/src
Wget-d "HTTP://MIRROR.BIT.EDU.CN/APACHE/TRAFFICSERVER/TRAFFICSERVER-5.3.0.TAR.BZ2"
Tar jxvf trafficserver-5.3.0.tar.bz2
CD trafficserver-5.3.0
Go to the source directory, read the Readme file, get the installation instructions on CentOS 6.3, seem to see little new things, or start with the official website installation Guide
Https://cwiki.apache.org/confluence/display/TS/CentOS

2. Installing dependent Packages
Yum-y install git gcc gcc-c++ autoconf automake libtool pkgconfig pcre-devel tcl-devel expat-devel openssl-devel
Yum-y Install Perl-extutils-makemaker
Yum-y Install Libcap libcap-devel hwloc hwloc-devel
Yum-y Install Libunwind Libunwind-devel

3. Make sure the system log is turned on
Use the following command
Service Rsyslog Status
Check that the system log has not been turned on and is not on, to avoid any log information when there is an error starting ATS below.


Create an ATS run user name and group name
This step is critical, related to the success of the next make install step, so get the front to do.
New user
Useradd-s/sbin/nologin Tserver
We intend to use Tserver as the user and group name for ATS. Use the following command to detect if a user group was created successfully

CAT/ETC/PASSWD |cut-f 1-d: | grep tserver



4. Compiling the installation
First use./configure-h to view support
./configure--prefix=/opt/ats--with-user=tserver--with-group=tserver--enable-reclaimable-freelist--enable-debug --enable-experimental-plugins Intranet test does not add--enable-interim-cache
Make-j 4
Make Install-j 4

5. Configuration
There are several main files that need to be configured:
Records.config,storage.config,logs_xml.config

The effects I want to achieve are forward and reverse proxies, custom disks, custom logs, and more. Note that the Records.config file is much leaner.

Because it is a company intranet virtual machine, configuration is poor, there is no disk and cache-related options configured. #records. config
CONFIG proxy.config.http.server_ports STRING 8081 #跟线上保持一致
Traffic_line-s Proxy.config.reverse_proxy.enabled-v 0
Traffic_line-s proxy.config.url_remap.remap_required-v 0 #1为只反向代理, 0 for forward + reverse proxy
Traffic_line-s Proxy.config.url_remap.pristine_host_hdr-v 0

Traffic_line-s Proxy.config.http.insert_request_via_str-v 1
Traffic_line-s proxy.config.http.insert_response_via_str-v 2 #会产生类似Via: http/1.1 localhost (apachetrafficserver/ 4.2.3 [CHs F]) head
Traffic_line-s proxy.config.http.cache.required_headers-v 0 #配置在源服务器没有定义缓存的情况缓存文件
Traffic_line-s Proxy.config.http.cache.enable_default_vary_headers-v 1
Traffic_line-s proxy.config.cache.ram_cache_cutoff-v 40960 #非常关键 to determine whether the cache hit is in RAM cache or SSD

CONFIG proxy.config.log.custom_logs_enabled INT 1
CONFIG proxy.config.log.squid_log_enabled INT 0
CONFIG proxy.config.log.xml_config_file STRING Logs_xml.config

#logs_xml. config
<LogFormat>
<name = "Access"/>
<format = "%<cqtq>%<ttms>%<pssc>%<sssc> [%<cqtt>]%<{x-forwarded-for}cqh> \" %<cqtx>\ "%<psql> \"%<pqsi>\ "%<crc>:%<phr>%<{referer}cqh> \"%<{User-Agent} Cqh>\ "%<psct>"/>
</LogFormat>
<LogObject>
<format = "Access"/>
<filename = "Access"/>
</LogObject>

6. Adding environment variables and setting aliases
echo "Export path=/opt/ats/bin: $PATH" >>/etc/profile
Update configuration file
Source/etc/profile
Re-confirm that the environment variable is added successfully
Echo $PATH

In this case, run Trafficserver start directly on the command line to identify it.

Vim ~/.BASHRC

Add at the tail

Alias ats_db= ' Cd/opt/ats/var/trafficserver;pwd '
alias ats_log= ' Cd/opt/ats/var/log/trafficserver;pwd '
Alias ats_conf= ' Cd/opt/ats/etc/trafficserver;pwd '
alias ats_lib= ' Cd/opt/ats/libexec/trafficserver;pwd '
Alias ats_bin= ' Cd/opt/ats/bin;pwd '
alias ats_stat= ' PS auxf | grep traffic | grep-v grep '
alias ats_ports= ' Netsta T-NLTP | grep Traffic | Grep-v grep '

Make a file effective
SOURCE ~/.BASHRC


7. Start the test
Trafficserver start
When the start OK, use the following command to see the process start situation, try several times, observe the traffic_server process PID changes, if there is a change in the START process is a problem, need to troubleshoot detailed issues

PS AUXF | grep Traffic | Grep-v grep


Use curl below for a simple test
Curl-o/dev/null-vx 127.0.0.1:8081-h "ACCEPT-ENCODING:GZIP,DEFLATE,SDCH" "http://news.sohu.com"
To see if it succeeds, if it succeeds, executes 3 times the same request continuously, observing the change of the cache state, is the following status code change?

[CMSSFW] ==> [CHs f] ==> [CRs f] ==> ...



Then observe if there are 3 corresponding access records in the access log


Observe the next few log files again


The Manager.log is specifically responsible for monitoring the operation of the Traffic_server process, which restarts the traffic_server process in the event of an exception.
Diags.config specifically records system diagnostic logs, such as cache index files, hostdb files, clear disk conditions, cache availability, etc.

Traffic.out specifically records console-related log information, such as the root directory used, and finds that the log information is less than the original version input





8. Command-line tool exploration

There are no Traffic_shell tools, but tools such as Traffic_ctl,traffic_crashlog,traffic_via,traffic_layout are added.


In particular, there is another extremely useful tool Traffic_crashlog, which is launched with the three processes in Trafficserver,



Always monitor if a traffic_server process crashes, and if a crash occurs,
It will automatically restart the Traffic_server process while printing the relevant segment error message, the main content includes CPU, signal, thread call stack, configuration information in Records.config and so on.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.