免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12下一页
最近访问板块 发新帖
查看: 7835 | 回复: 10
打印 上一主题 下一主题

[proxy] Apache Traffic Server 3.0正式版,我很失望!! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-07-07 15:10 |只看该作者 |倒序浏览
本帖最后由 tao_627 于 2011-07-07 15:25 编辑

研究Traffic Server已经几个月了,最初看得是2.0.1稳定版,后来看过2.1.4,直到最近,欣喜发现Apache已经发布了3.0版本。于是赶紧下载安装,搭建正向代理,调试探索,可是很失望,
因为一直显示502错误,可是,我利用2.1.4搭建正向代理,一切正常没有任何问题。下面是3.0版本的整个交互过程的信息,感兴趣的朋友可以看看,我从不说假话的:


ATS 3.0搭建正向代理出现502错误的整个交互流程:

root@tyx-System-Product-Name:/usr/local/bin# ./traffic_server
[TrafficServer] using root directory '/usr/local'
[Jul  6 08:56:36.765] {3077691088} STATUS: opened /usr/local/var/log/trafficserver/diags.log
[Jul  6 08:56:36.765] {3077691088} NOTE: updated diags config
[Jul  6 08:56:36.766] Server {3077691088} DEBUG: (http_aeua) [HttpConfig::init_aeua_filter] - Config: "/usr/local/etc/trafficserver/ae_ua.config"
[Jul  6 08:56:36.766] Server {3077691088} DEBUG: (http_aeua) [HttpConfig::init_aeua_filter] - Opening config "/usr/local/etc/trafficserver/ae_ua.config"
[Jul  6 08:56:36.766] Server {3077691088} DEBUG: (http_aeua) [HttpConfig::init_aeua_filter] - Added 0 REGEXP filters
[Jul  6 08:56:36.766] Server {3077691088} DEBUG: (http_aeua) [init_http_aeua_filter] - Total loaded 0 REGEXP for Accept-Enconding/User-Agent filtering
[Jul  6 08:56:36.768] Server {3077691088} NOTE: cache clustering disabled
[Jul  6 08:56:36.768] Server {3077691088} NOTE: clearing statistics
[Jul  6 08:56:36.770] Server {3077691088} DEBUG: (dns) ink_dns_init: called with init_called = 0
[Jul  6 08:56:36.779] Server {3077691088} DEBUG: (dns) localhost=tyx-System-Product-Name
[Jul  6 08:56:36.779] Server {3077691088} DEBUG: (dns) Round-robin nameservers = 0
[Jul  6 08:56:36.779] Server {3077691088} DEBUG: (hostdb) Storage path is /usr/local/var/trafficserver
[Jul  6 08:56:36.779] Server {3077691088} DEBUG: (hostdb) Opening host.db, size=200000
[Jul  6 08:56:36.779] Server {3077691088} WARNING: configuration changed: [hostdb.config] : reinitializing database
[Jul  6 08:56:36.779] Server {3077691088} NOTE: reconfiguring host database
[Jul  6 08:56:36.779] Server {3077691088} DEBUG: (hostdb) unable to unlink /usr/local/etc/trafficserver/internal/hostdb.config
[Jul  6 08:56:36.779] Server {3077691088} WARNING: Configured store too small, unable to reconfigure
[Jul  6 08:56:36.779] Server {3077691088} WARNING: unable to initialize database (too little storage)
: [hostdb.config] : disabling database
You may need to 'reconfigure' your cache manually.  Please refer to
the 'Configuration' chapter in the manual.

论坛徽章:
0
2 [报告]
发表于 2011-07-07 15:12 |只看该作者
[Jul  6 08:56:36.779] Server {3077691088} WARNING: could not initialize host database. Host database will be disabled
[Jul  6 08:56:36.779] Server {3077691088} WARNING: bad hostdb or storage configuration, hostdb disabled
[Jul  6 08:56:36.780] Server {3077691088} NOTE: cache clustering disabled
[Jul  6 08:56:36.834] Server {3057408880} WARNING: disk header different for disk /usr/local/var/trafficserver/cache.db: clearing the disk
[Jul  6 08:56:36.884] Server {3077691088} NOTE: logging initialized[7], logging_mode = 3
[Jul  6 08:56:36.887] Server {3077691088} DEBUG: (http_init) proxy.config.http.redirection_enabled = 0
[Jul  6 08:56:36.887] Server {3077691088} DEBUG: (http_init) proxy.config.http.number_of_redirections = 1
[Jul  6 08:56:36.887] Server {3077691088} DEBUG: (http_init) proxy.config.http.post_copy_size = 2048
[Jul  6 08:56:36.887] Server {3077691088} DEBUG: (http_tproxy) Primary listen socket transparency is off
[Jul  6 08:56:36.890] Server {3077691088} NOTE: traffic server running
[Jul  6 08:56:36.890] Server {3077691088} DEBUG: (dns) DNSHandler::startEvent: on thread 0
[Jul  6 08:56:36.890] Server {3077691088} DEBUG: (dns) open_con: opening connection 8.8.8.8:53
[Jul  6 08:56:36.890] Server {3077691088} DEBUG: (dns) random port = 42595
[Jul  6 08:56:36.890] Server {3077691088} DEBUG: (dns) opening connection 8.8.8.8:53 SUCCEEDED for 0
[Jul  6 08:56:36.918] Server {3058461552} NOTE: Clearing Disk: /usr/local/var/trafficserver/cache.db
[Jul  6 08:56:36.919] Server {3058461552} NOTE: clearing cache directory '/usr/local/var/trafficserver/cache.db 16384:24575'
[Jul  6 08:56:37.056] Server {3055303536} NOTE: cache enabled
[Jul  6 08:56:45.632] Server {3002059632} DEBUG: (http_tproxy) Marking accepted connect on b328c6e8 as not outbound transparent.
[Jul  6 08:56:45.632] Server {3077691088} DEBUG: (http_seq) HttpAccept:mainEvent] accepted connection
[Jul  6 08:56:45.632] Server {3077691088} DEBUG: (http_cs) [0] session born, netvc 0xa431d60
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http_cs) [0] using accept inactivity timeout [120 seconds]
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http_cs) [0] Starting transaction 1 using sm [0]
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http) [0] [HttpSM::main_handler, VC_EVENT_READ_READY]
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http) [0] [&HttpSM::state_read_client_request_header, VC_EVENT_READ_READY]
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http) [0] done parsing client request header
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http_trans) START HttpTransact::ModifyRequest
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http_trans) [ink_cluster_time] local: 1309913805, highest_delta: 0, cluster: 1309913805
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http_trans) END HttpTransact::ModifyRequest
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http_trans) Next action HTTP_API_READ_REQUEST_HDR; HttpTransact::StartRemapRequest
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http) [0] State Transition: STATE_UNDEFINED -> API_READ_REQUEST_HDR
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http_trans) START HttpTransact::StartRemapRequest
[Jul  6 08:56:45.633] Server {3077691088} DEBUG: (http_trans) Before Remapping:

论坛徽章:
0
3 [报告]
发表于 2011-07-07 15:13 |只看该作者
+++++++++ Incoming Request +++++++++
-- State Machine Id: 0
GET http://www.baidu.com/ HTTP/1.1
Host: www.baidu.com
User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:2.0.1) Gecko/20100101 Firefox/4.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.5
Accept-Encoding: gzip, deflate
Accept-Charset: GB2312,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Proxy-Connection: keep-alive
Cookie: BAIDUID=36C3F2905F6D124039D771A6F85E124A:FG=1

[Jul  6 08:56:45.653] Server {3077691088} DEBUG: (http_trans) [DecideCacheLookup] Will do cache lookup.
[Jul  6 08:56:45.653] Server {3077691088} DEBUG: (http_seq) [DecideCacheLookup] Will do cache lookup
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_trans) Next action CACHE_LOOKUP; NULL
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] State Transition: HTTP_API_POST_REMAP -> CACHE_LOOKUP
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_seq) [HttpSM::do_cache_lookup_and_read] [0] Issuing cache lookup for URL http://www.baidu.com/
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_cache) [0] [&HttpCacheSM::state_cache_open_read, CACHE_EVENT_OPEN_READ_FAILED]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] [HttpSM::main_handler, CACHE_EVENT_OPEN_READ_FAILED]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] [&HttpSM::state_cache_open_read, CACHE_EVENT_OPEN_READ_FAILED]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] cache_open_read - CACHE_EVENT_OPEN_READ_FAILED
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [state_cache_open_read] open read failed.
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_trans) [HttpTransact::HandleCacheOpenRead]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_trans) CacheOpenRead -- miss
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_trans) Next action DNS_LOOKUP; OSDNSLookup
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] State Transition: CACHE_LOOKUP -> DNS_LOOKUP
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_seq) [HttpStateMachineGet::do_hostdb_lookup] Doing DNS Lookup
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] DNS lookup failed for 'www.baidu.com'
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_trans) [HttpTransact::OSDNSLookup] This was attempt 1
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_seq) [HttpTransact::OSDNSLookup] DNS Lookup unsuccessful
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_trans) [WUTS code generation] Hit/Miss: 49, Log: 117, Hier: 49, Status: 805
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_trans) Adding Server: ATS/3.0.0
+++++++++ Proxy's Response 2 +++++++++
-- State Machine Id: 0
HTTP/1.1 502 Cannot find server.
Date: Wed, 06 Jul 2011 00:56:45 GMT
Proxy-Connection: keep-alive
Server: ATS/3.0.0

[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_trans) Next action PROXY_SEND_ERROR_CACHE_NOOP; NULL
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] State Transition: DNS_LOOKUP -> PROXY_SEND_ERROR_CACHE_NOOP
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_tunnel) [0] adding producer 'internal msg'
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_tunnel) [0] adding consumer 'user agent'
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_tunnel) tunnel_run started, p_arg is NULL
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_tunnel) [0] consumer_handler [user agent VC_EVENT_WRITE_COMPLETE]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] [&HttpSM::tunnel_handler_ua, VC_EVENT_WRITE_COMPLETE]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_cs) [0] session released by sm [0]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_cs) [0] initiating io for next header
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] [HttpSM::main_handler, HTTP_TUNNEL_EVENT_DONE]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] [&HttpSM::tunnel_handler, HTTP_TUNNEL_EVENT_DONE]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_redirect) [HttpTunnel::deallocate_postdata_copy_buffers]
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http_seq) [HttpStateMachineGet::update_stats] Logging transaction
[Jul  6 08:56:45.654] Server {3077691088} DEBUG: (http) [0] dellocating sm

论坛徽章:
0
4 [报告]
发表于 2011-07-07 15:22 |只看该作者
本帖最后由 tao_627 于 2011-07-07 15:24 编辑

大家一定要注意1楼最后几句话,它说明traffic server无法使用hostdb,最终将导致502错误发生,我详细比较了2.1.4和3.0版本的配置文件,以及HostDB.cc和MultiCache.cc这几个文件,并进行了多次调试,最后发现它们几乎100%相同,唯一修改的地方,就是我得到502错误的地方,就是两行代码的修改,导致了这个错误。我以及成功修复了这个502错误的bug。

另外,我写的plugin,在2.1.4版本上测试没有发现问题,可是在3.0上却经常使程序退出,唯一的区别是plugin引用 的API不同,这说明3.0版本的API也存在问题。

可悲的是,现在Apache已经不再提供2.1.9等unstable版本了,而这个他们很引以为傲的3.0,却被我证实漏洞百出,令人失望。

我发这个帖子,期望有缘人共同探讨,进行技术切磋,希望Apache能引起重视,别无它意!

论坛徽章:
0
5 [报告]
发表于 2011-07-10 23:57 |只看该作者
Leif 在你提的Bug里的回复是准确的,请按照提提到的2点检查。
我们为什么将2.1.x定义为unstable,并不是因为他更不稳定,而是因为我们每个版本间会做比较大的改动,不能保证各个版本间的升级不产生问题。

到了3.0稳定版本中,我们将会保证版本的api abi以及配置文件等的一致性。

强力推荐rebase你的所有工作到v3.0上来。2.1.4是我们最后的小改动,2.1.5-2.1.9中间做的大改动可就太多了。

有任何问题随时反馈。

thanks

论坛徽章:
0
6 [报告]
发表于 2011-08-18 03:02 |只看该作者
楼主,方便提供以下配置文件吗?我一直在找ats到正向代理配置。

论坛徽章:
0
7 [报告]
发表于 2011-08-18 09:29 |只看该作者
本帖最后由 yayu_myself 于 2011-08-18 09:34 编辑

回复 6# molecar


    呃。。正向代理很简单的。。只需要把record.conf中的
  1. CONFIG proxy.config.reverse_proxy.enabled INT 0
  2. CONFIG proxy.config.url_remap.remap_required INT 0
复制代码
其实好像只把remap设置为0就可以,TS支持同时反响和正向代理

另外,先看官方管理手册,有中文的,但是后面的不太全,结合英文看吧http://trafficserver.apache.org/docs/v2/admin/,FAQ提到了如下:
Can Traffic Server run in forward proxy and reverse proxy modes at the same time?

Yes. When you enable reverse proxy mode, Traffic Server remaps incoming requests according to the map rules in the remap.config file. All other requests that do not match a map rule are simply served in forward proxy mode.
If you want to run in reverse proxy only mode (wherein Traffic Server does not serve requests that fail to match a map rule), then you must set the configuration variable proxy.config.url_remap.remap_required to 1 in the records.config file.

How do I enable forward proxy mode

Forward proxy mode is not enabled out of the box for security reasons. When enabling any proxy on the internet, you want to make sure you observe pertinent security restrictions. Having an open proxy available to internet users is a bad thing. If you understand this and are sure you know what you are doing, in records.config:
# Set this variable to 1 if you want Traffic Server to serve
# requests only from origin servers listed in the mapping rules
# of the remap.config file. If a request does not match, then
# the browser will receive an error.
CONFIG proxy.config.url_remap.remap_required INT 0


还可以看官方wiki里面有一些东西。不过感觉还算比较乱,里面同样有FAQ:https://cwiki.apache.org/confluence/display/TS/FAQ

以及官方的社区:https://issues.apache.org/jira/secure/IssueNavigator.jspa

论坛徽章:
0
8 [报告]
发表于 2012-01-31 12:47 |只看该作者
yayu_myself 发表于 2011-08-18 09:29
回复 6# molecar


非常感谢,纠结我两天的问题终于解决了

论坛徽章:
49
15-16赛季CBA联赛之福建
日期:2016-06-22 16:22:002015年亚洲杯之中国
日期:2015-01-23 16:25:12丑牛
日期:2015-01-20 09:39:23未羊
日期:2015-01-14 23:55:57巳蛇
日期:2015-01-06 18:21:36双鱼座
日期:2015-01-02 22:04:33午马
日期:2014-11-25 09:58:35辰龙
日期:2014-11-18 10:40:07寅虎
日期:2014-11-13 22:47:15申猴
日期:2014-10-22 15:29:50摩羯座
日期:2014-08-27 10:49:43辰龙
日期:2014-08-21 10:47:58
9 [报告]
发表于 2012-03-07 17:42 |只看该作者
tao_627 发表于 2011-07-07 15:10
研究Traffic Server已经几个月了,最初看得是2.0.1稳定版,后来看过2.1.4,直到最近,欣喜发现Apache已经发 ...

楼主不见了,嘿嘿

论坛徽章:
0
10 [报告]
发表于 2012-03-07 17:57 |只看该作者
啥情况,这个帖子的问题已经close了的吧?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP