完整配置示例
完整配置示例
TS 配置文件路径在/etc/trafficserver/,分功能配置不同配置文件,常用的配置文件如下:
- records.config 主功能参数配置文件
- remap.config 业务域名规则配置文件
- storage.config Cache 存储配置文件
配置示例
Storage.config
ATS 支持目录配置,也支持裸盘配置,无需文件系统支持
目录配置方式
1. #cat /etc/trafficserver/storage.config2. /var/cache/trafficserver 256M
裸盘配置方式
1. #cat /etc/trafficserver/storage.config2. /dev/sdb3. /dev/sdc4. /dev/sdd
初始化磁盘目录
1. traffic_server -Cclear
Records.config
records.config 大多保持默认配置就好
注意:
traffic_line模式修改配置需要保证ATS是运行的
1. #用于标识名称,Cluster模式下同一集群必须保持一致才能建立集群2. traffic_line -s proxy.config.proxy_name -v test4. #配置cluster 模式5. - 1 纯cluster 模式,有7层代理功能和集群配置同步6. - 2 仅做配置管理7. - 3 单机模式8. traffic_line -s proxy.local.cluster.type -v 110. #自动配置线程数,多少个CPU配置多少个线程,可调整11. traffic_line -s proxy.config.exec_thread.autoconfig -v 112. traffic_line -s proxy.config.exec_thread.autoconfig.scale -v 114. #监听8080、80端口,8080 一般用于管理端口,80为服务端口15. traffic_line -s proxy.config.http.server_ports -v 8080 8017. #Cache内存大小,-1 为不限制,具体大小结合业务调整,内存命中越高磁盘IO越小18. traffic_line -s proxy.config.cache.ram_cache.size -v 2576980377620. #Cache内存淘汰算法,采用CLFUS,LRU 模式有问题21. traffic_line -s proxy.config.cache.ram_cache.algorithm -v 123. #传输超时时间,默认900s,传输大文件容易触发超时,改成不限制24. traffic_line -s proxy.config.http.transaction_active_timeout_in -v 026. #negative TTL 功能开启27. traffic_line -s proxy.config.http.negative_caching_enabled -v 129. #忽略判断Accept头,默认会根据Accept头做多副本缓存30. traffic_line -s proxy.config.http.cache.ignore_accept_mismatch -v 132. #忽略判断Accept-Language头,默认会根据Accept-Language头做多副本缓存33. traffic_line -s proxy.config.http.cache.ignore_accept_language_mismatch -v 135. #忽略判断Accept-Charset头,默认会根据Accept-Charset头做多副本缓存36. traffic_line -s proxy.config.http.cache.ignore_accept_charset_mismatch -v 138. #忽略client max-age39. traffic_line -s proxy.config.http.cache.ignore_client_cc_max_age -v 141. #忽略HTTP认证头,默认带Authentication是不做缓存的42. traffic_line -s proxy.config.http.cache.ignore_authentication -v 144. #开启vary 功能45. traffic_line -s proxy.config.http.cache.enable_default_vary_headers -v 147. #开启回源合并48. traffic_line -s proxy.config.cache.enable_read_while_writer -v 150. #平均object 大小,结合业务配置51. traffic_line -s proxy.config.cache.min_average_object_size -v 1638453. #开启HTTP UI54. traffic_line -s proxy.config.http_ui_enabled -v 3
remap.config
1. #HTTP UI 接口2. http localhost:8080 {3. map /cache-internal/ http://{cache-internal}4. map /cache/ http://{cache}5. map /stat/ http://{stat}6. map /test/ http://{test}7. map /hostdb/ http://{hostdb}8. map /net/ http://{net}9. map /http/ http://{http}10. map /migrate/ http://{migrate}11. }13. #域名规则14. http www.taobao.com {15. map / http://www.taobao.com/16. }
