架构设计之学习(1)
当访问www.google.com的时候,您是否注意到url却重定向成为这样:www.google.com/intl/zh-CN/ 为何会这样?为何不是uk,不是fr,而是cn呢?
其实这些都已经在Google集群架构设计中作了说明。对于Google集群架构,这可就说来话长了。暂不细说。我们先从简单却重要的技术说起——DNS.
DNS, Domain name System. RFC1034对DNS做了详细的阐述,当然现在的版本都是基于此之上的扩展。DNS采用分布式数据库,分层授权控制多区段域名。当前全球12个root names servers,分别是:
A.ROOT-SERVERS.NET. 588402 IN A 198.41.0.4
B.ROOT-SERVERS.NET. 415610 IN A 192.228.79.201
C.ROOT-SERVERS.NET. 503628 IN A 192.33.4.12
D.ROOT-SERVERS.NET. 507504 IN A 128.8.10.90
E.ROOT-SERVERS.NET. 415610 IN A 192.203.230.10
F.ROOT-SERVERS.NET. 507271 IN A 192.5.5.241
G.ROOT-SERVERS.NET. 415610 IN A 192.112.36.4
H.ROOT-SERVERS.NET. 415610 IN A 128.63.2.53
I.ROOT-SERVERS.NET. 503414 IN A 192.36.148.17
K.ROOT-SERVERS.NET. 503414 IN A 193.0.14.129
L.ROOT-SERVERS.NET. 509660 IN A 198.32.64.12
M.ROOT-SERVERS.NET. 504758 IN A 202.12.27.33
而我,现在adsl分配给我的ip是61.174.146.232,是属于哪儿的name server?
232.146.174.61.in-addr.arpa. 78000 IN PTR 232.146.174.61.broad.hz.zj.dynamic.cndata.com.
174.61.in-addr.arpa. 43518 IN NS dns-noc.zjhzptt.net.cn.
174.61.in-addr.arpa. 43518 IN NS ns.zjnbptt.net.cn.
当client向local dns server查询一个域名,若此域名所属的class属于这个local dns server,则将此域名所对应的ip返回给client;若不属于此class,则会从root ns一路查下来:
;; local name server: 202.96.209.133
;; global options: printcmd
. 325286 IN NS C.ROOT-SERVERS.NET.
. 325286 IN NS D.ROOT-SERVERS.NET.
. 325286 IN NS E.ROOT-SERVERS.NET.
. 325286 IN NS F.ROOT-SERVERS.NET.
. 325286 IN NS G.ROOT-SERVERS.NET.
. 325286 IN NS H.ROOT-SERVERS.NET.
. 325286 IN NS I.ROOT-SERVERS.NET.
. 325286 IN NS J.ROOT-SERVERS.NET.
. 325286 IN NS K.ROOT-SERVERS.NET.
. 325286 IN NS L.ROOT-SERVERS.NET.
. 325286 IN NS M.ROOT-SERVERS.NET.
. 325286 IN NS A.ROOT-SERVERS.NET.
. 325286 IN NS B.ROOT-SERVERS.NET.
;; Received 436 bytes from 202.96.209.133#53(202.96.209.133) in 30 ms
com. 172800 IN NS A.GTLD-SERVERS.NET.
com. 172800 IN NS G.GTLD-SERVERS.NET.
com. 172800 IN NS H.GTLD-SERVERS.NET.
com. 172800 IN NS C.GTLD-SERVERS.NET.
com. 172800 IN NS I.GTLD-SERVERS.NET.
com. 172800 IN NS B.GTLD-SERVERS.NET.
com. 172800 IN NS D.GTLD-SERVERS.NET.
com. 172800 IN NS L.GTLD-SERVERS.NET.
com. 172800 IN NS F.GTLD-SERVERS.NET.
com. 172800 IN NS J.GTLD-SERVERS.NET.
com. 172800 IN NS K.GTLD-SERVERS.NET.
com. 172800 IN NS E.GTLD-SERVERS.NET.
com. 172800 IN NS M.GTLD-SERVERS.NET.
;; Received 492 bytes from 128.8.10.90#53(D.ROOT-SERVERS.NET) in 580 ms
google.com. 172800 IN NS ns1.google.com.
google.com. 172800 IN NS ns2.google.com.
google.com. 172800 IN NS ns3.google.com.
google.com. 172800 IN NS ns4.google.com.
;; Received 168 bytes from 192.5.6.30#53(A.GTLD-SERVERS.NET) in 1251 ms
www.google.com. 604800 IN CNAME www.l.google.com.
l.google.com. 86400 IN NS a.l.google.com.
l.google.com. 86400 IN NS b.l.google.com.
l.google.com. 86400 IN NS c.l.google.com.
l.google.com. 86400 IN NS d.l.google.com.
l.google.com. 86400 IN NS e.l.google.com.
l.google.com. 86400 IN NS g.l.google.com.
;; Received 244 bytes from 216.239.32.10#53(ns1.google.com) in 260 ms
在ns1.google.com这个所属的name server里,我们在来看看:
;; ANSWER SECTION:
www.google.com. 411943 IN CNAME www.l.google.com.
www.l.google.com. 405 IN CNAME www-china2.l.google.com.
www-china2.l.google.com. 309 IN A 64.233.189.165
;; AUTHORITY SECTION:
l.google.com. 66362 IN NS c.l.google.com.
l.google.com. 66362 IN NS d.l.google.com.
l.google.com. 66362 IN NS e.l.google.com.
l.google.com. 66362 IN NS g.l.google.com.
l.google.com. 66362 IN NS a.l.google.com.
l.google.com. 66362 IN NS b.l.google.com.
;; ADDITIONAL SECTION:
a.l.google.com. 73562 IN A 216.239.53.9
b.l.google.com. 68442 IN A 64.233.179.9
c.l.google.com. 68438 IN A 64.233.161.9
d.l.google.com. 68391 IN A 64.233.183.9
e.l.google.com. 68172 IN A 66.102.11.9
g.l.google.com. 68442 IN A 64.233.167.9
;; Query time: 30 msec
;; SERVER: 202.96.209.133#53(202.96.209.133)
;; WHEN: Mon Oct 02 15:00:28 2006
;; MSG SIZE rcvd: 285
因此,当我查询google.com的时候,name server告诉我这个域名对于的ip是:64.233.189.165.
No comments:
Post a Comment