全部博文(151)
分类: LINUX
2009-11-22 22:51:36
gcc-c++
glibc-devel.i586
db4-devel.i586
openssl-devel.i586
tcl-devel.i586
expat-devel.i586
mkdir /tmp/ts
cd /tmp/ts svn checkout http://svn.apache.org/repos/asf/incubator/trafficserver/traffic/trunk traffic-trunk.svn
cd /tmp/traffic-trunk.svn; autoreconf -i ;./configure --prefix=/home/ts -;make -j32;make install
由于代码问题,安装好后需要做一些link,才能让软件正常运行(可能是代码从yahoo迁移过来,还有yahoo的痕迹没改彻底)
mkdir /home/ts/conf ;cd /home/ts/conf ;ln -s /home/ts/etc/trafficserver yts mkdir /home/ts/conf/yts/internal/ 代码里有一个相对路径写错了,同样需要做一个link来解决 mkdir /home/ts/home ;cd /home/ts/home ;ln -s /home/ts ts
至此,安装完成
配置文件都在 /home/ts/etc/trafficserver
主要有3个需要修改
CONFIG proxy.config.proxy_name STRING cache1 ### 修改成cache的server name即可 CONFIG proxy.config.cluster.ethernet_interface STRING eth0 ### 修改成需要侦听的interface名称,默认是 null CONFIG proxy.config.admin.user_id STRING root ### 用来运行 traffic server 的用户,默认是nobody CONFIG proxy.config.http.server_port INT 80 ### traffic server 侦听的端口,默认是8080
其他配置可自习根据情况修改
如果要对 加速
则写为
map (或者域名) | |_____ 代理服务器需要访问的源站点的ip或者域名 |__用户最终访问的域名
使用raw deivces,将物理磁盘绑定到raw device
mknod /dev/rawctl c 162 0 chmod 600 /dev/rawctl 这个很重要,还需要给与运行traffice server的属主,我是用root运行,所有这样就可以了 mknod /dev/raw_sdb c 162 1 mknod /dev/raw_sdc c 162 2
/usr/bin/raw /dev/raw_sdb /dev/sdb /usr/bin/raw /dev/raw_sdc /dev/sdc
/usr/bin/raw -q /dev/raw/raw_sdb 或者 /usr/bin/raw -a
blockdev --getsize /dev/raw_sdb blockdev --getss /dev/raw_sdb
让后将这2个值相乘得到 raw最终值 即下面的 300000000000
/dev/raw_sdb 300000000000 /dev/raw_sdc 300000000000
nohup /home/ts/bin/traffic_manager >../var/log/trafficserver/ts.log 2>&1 &
查看进程情况
ps -ef
应该能看到
bin/traffic_server -M -A8:X ##server 服务进程
#netstat -npa |grep traff tcp 0 0 0.0.0.0:20098 0.0.0.0:* LISTEN 18117/traffic_manag tcp 0 0 0.0.0.0:9898 0.0.0.0:* LISTEN 18117/traffic_manag tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 18117/traffic_manag tcp 0 0 0.0.0.0:8083 0.0.0.0:* LISTEN 18117/traffic_manag tcp 0 0 0.0.0.0:8084 0.0.0.0:* LISTEN 18148/traffic_serve tcp 0 0 0.0.0.0:8088 0.0.0.0:* LISTEN 18117/traffic_manag udp 0 0 172.22.26.91:29611 172.22.5.128:53 ESTABLISHED 18148/traffic_serve unix 2 [ ACC ] STREAM LISTENING 738846890 18117/traffic_manag ./conf/yts//process_server unix 2 [ ACC ] STREAM LISTENING 738846893 18117/traffic_manag /home/ts/etc/trafficserver/mgmtapisocket unix 2 [ ACC ] STREAM LISTENING 738846895 18117/traffic_manag /home/ts/etc/trafficserver/eventapisocket unix 2 [ ACC ] STREAM LISTENING 738847082 18117/traffic_manag /home/ts/etc/trafficserver/cli unix 2 [ ] DGRAM 738846975 18148/traffic_serve unix 3 [ ] STREAM CONNECTED 738846917 18117/traffic_manag ./conf/yts//process_server unix 3 [ ] STREAM CONNECTED 738846916 18148/traffic_serve unix 2 [ ] DGRAM 738846880 18117/traffic_manag
- /home/ts/bin/traffic_line -x 生效,不需要重启应用
%提示符 %show % show:cache ###cache 基本配置 FTP Caching ---------------------------- off NNTP Caching --------------------------- on Ignore User Requests To Bypass Cache --- on Maximum HTTP/FTP Object Size ----------- 1024000 Freshness Verify Freshness By Checking --------- When The Object Has Expired Minimum Information to be Cacheable -- A Last Modified Time If Object has no Expiration Date: Leave it in Cache for at least ----- 86400 s but no more than ------------------- 86400 s FTP Cached Objects Expire After ------ 259200 s Variable Content Cache Responses to URLs that contain "?",";","cgi" or end in ".asp" ----- on Alternates Enabled ------------------- off Vary on HTTP Header Fields: Text ------------------------------- NULL Images ----------------------------- NULL Other ------------------------------ NULL Cache responses to requests containing cookies for: All Content-types % show:cache-stats Bytes Used --- 74 GB Cache Size --- 1395 GB --RAM Cache-- Total Bytes -- 1497216000 Bytes Used --- 950272 Hits --------- 34 Misses ------- 88 % show:proxy-stats Document Hit Rate -------- 58.490568 % * Bandwidth Saving --------- 10.361657 % * Cache Percent Free ------- 94.634068 % Open Server Connections -- 0 Open Client Connections -- 0 Open Cache Connections --- 0 Client Throughput -------- 0.000000 MBit/Sec Transaction Per Second --- 0.000000 * Value represents 10 second average.
其他请大家参考帮助或者自己测试使用
Usage: logstats [-l logfile] [-o origin[,...]] [-O originfile] [-m minhits] [-inshv] switch__________________type__default___description -h, --help tog true Give this help -f, --log_file str (null) Specific logfile to parse -o, --origin_list str (null) Only show stats for listed Origins -O, --origin_file str (null) File listing Origins to show -i, --incremental tog false Incremental log parsing -S, --statetag str (null) Name of the state file to use -t, --tail int 0 Parse the lastseconds of log -s, --summary tog false Only produce the summary -y, --ymon tog false Output is formatted for YMon/Nagios -Y, --ysar tog false Output is formatted for YSAR -m, --min_hits i64 0 Minimum total hits for an Origin -a, --max_age int 0 Max age for log entries to be considered -l, --line_len int 78 Output line length -T, --debug_tags str (null) Colon-Separated Debug Tags -V, --version tog false Print Version Id
例如
logstats -i
会根据日志分析cache的命中等情况
如果服务器down掉,默认会生成core文件,在/home/ts
使用
/home/ts/bin/traffic_server -c core.1234
来阅读coredump文件
原文地址 |