-
Notifications
You must be signed in to change notification settings - Fork 0
/
架构.html
317 lines (175 loc) · 7.53 KB
/
架构.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<!DOCTYPE html>
<!--[if IEMobile 7 ]><html class="no-js iem7"><![endif]-->
<!--[if lt IE 9]><html class="no-js lte-ie8"><![endif]-->
<!--[if (gt IE 8)|(gt IEMobile 7)|!(IEMobile)|!(IE)]><!--><html class="no-js"><!--<![endif]-->
<head>
<meta charset="utf-8">
<title>
架构 - 搁羽念风
</title>
<meta name="author" content="">
<meta name="description" content="">
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="asset/css/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
<link href="atom.xml" rel="alternate" title="搁羽念风" type="application/atom+xml">
<script src="asset/js/modernizr-2.0.js"></script>
<script src="asset/js/jquery.min.js"></script>
<script src="asset/highlightjs/highlight.pack.js"></script>
<link href="asset/highlightjs/styles/solarized_light.css" media="screen, projection" rel="stylesheet" type="text/css">
<script>hljs.initHighlightingOnLoad();</script>
<style type="text/css">
.cat-children-p{ padding: 6px 0px;}
.hljs{background: none;}
</style>
<script type="text/javascript">
var isAddSildbar = true;
</script>
<script src="asset/js/octopress.js" type="text/javascript"></script>
</head>
<script type="text/javascript">
//链接新开窗口
function addBlankTargetForLinks () {
$('a[href^="http"]').each(function(){
$(this).attr('target', '_blank');
});
}
$(document).ready(function(event) {
addBlankTargetForLinks();
});
</script>
<body >
<header role="banner"><hgroup>
<h1><a href="index.html">搁羽念风</a></h1>
<h2></h2>
</hgroup>
</header>
<nav role="navigation"><ul class="subscription" data-subscription="rss">
<li><a href="atom.xml" rel="subscribe-rss" title="subscribe via RSS">RSS</a></li>
</ul>
<form action="http://google.com/search" method="get">
<fieldset role="search">
<input type="hidden" name="q" value="site:" />
<input class="search" type="text" name="q" results="0" placeholder="Search"/>
</fieldset>
</form>
<ul class="main-navigation">
<li id=""><a target="self" href="index.html">Home</a></li>
<li id=""><a target="_self" href="archives.html">Archives</a></li>
</ul>
</nav>
<div id="main">
<div id="content">
<div class="blog-index">
<article>
<header>
<h1 class="entry-title"><a href="15529898481691.html">架构之CDN相关</a></h1>
<p class="meta"><time datetime="2019-03-19T18:04:08+08:00"
pubdate data-updated="true">2019/3/19</time></p>
</header>
<div class="entry-content">
<h2 id="toc_0">介绍</h2>
<p>CDN使用背景,图片的分布式存储</p>
<p>CDN 网络原理概述</p>
<p>批量添加、切换 CDN 的步骤和注意事项</p>
<p>多 CDN 切换的步骤和注意事项</p>
<p>CDN 访问故障分析</p>
<h2 id="toc_1">常见用法</h2>
<h3 id="toc_2">图片和静态资源的缓存</h3>
<h3 id="toc_3">一些变化不频繁的api缓存</h3>
<h2 id="toc_4">原理</h2>
<blockquote>
<p><code>wget -S -O /dev/null https://wx2.sinaimg.cn/crop.0.0.2000.1125/005K1HRGly1fzfme5l6ltj31jk0v9wm4.jpg</code></p>
</blockquote>
<h3 id="toc_5">一) 请求dns解析,并cname到cdn厂商的域名</h3>
<p><img src="media/15529898481691/15529924669316.jpg" alt="" style="width:1272px;"/></p>
<h3 id="toc_6">二) 再次请求dns解析,并获取到cdn厂商的全局负载均衡ip列表</h3>
<p><img src="media/15529898481691/15529924844889.jpg" alt="" style="width:1277px;"/></p>
<h3 id="toc_7">三) 全局负载均衡 根据客户端的<code>ip</code>,<code>url</code> 等信息内部请求 <code>区域负载均衡系统</code></h3>
<ol>
<li> <code>区域负载均衡</code>根据信息,逐层查找,获取离客户端<code>最近&有资源</code>的<code>缓存服务器</code>地址,</li>
<li> 返回给<code>全局负载均衡</code>(回源发生在这个阶段)</li>
<li> <code>全局负载均衡</code> 返回给客户端 该<code>缓存服务器</code>地址</li>
</ol>
<h3 id="toc_8">客户端请求<code>缓存服务器</code>,拿到文件</h3>
<p><img src="media/15529898481691/15529924296541.jpg" alt="" style="width:960px;"/></p>
<h2 id="toc_9">关键字</h2>
<h3 id="toc_10">回源</h3>
<blockquote>
<p>回源的意思就是,回到源头服务器取资源, 因为cdn为多级缓存,当请求资源404时,将逐层向上级cdn缓存获取资源,直至到服务器源站查找资源</p>
</blockquote>
<h3 id="toc_11">资源获取方式</h3>
<h4 id="toc_12">pull</h4>
<blockquote>
<p>逐层查找,资源不存在,最终到源头服务器获取资源并缓存到各级cdn</p>
</blockquote>
<h4 id="toc_13">push</h4>
<blockquote>
<p>源头服务器主动上传资源到cdn缓存服务器</p>
</blockquote>
</div>
</article>
<div class="pagination">
<a href="archives.html">Blog Archives</a>
</div>
</div>
<aside class="sidebar">
<section>
<h1>Categories</h1>
<ul id="recent_posts">
<li class="post">
<a href="go.html"><strong>go (3)</strong></a>
</li>
<li class="post">
<a href="redis.html"><strong>redis (3)</strong></a>
</li>
<li class="post">
<a href="%E5%B7%A5%E5%85%B7.html"><strong>工具 (2)</strong></a>
</li>
<li class="post">
<a href="%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F.html"><strong>设计模式 (3)</strong></a>
</li>
<li class="post">
<a href="clickhouse.html"><strong>clickhouse (4)</strong></a>
</li>
<li class="post">
<a href="php.html"><strong>php (4)</strong></a>
</li>
<li class="post">
<a href="%E6%9E%B6%E6%9E%84.html"><strong>架构 (1)</strong></a>
</li>
<li class="post">
<a href="%E8%BF%90%E7%BB%B4.html"><strong>运维 (2)</strong></a>
</li>
</ul>
</section>
<section>
<h1>Recent Posts</h1>
<ul id="recent_posts">
<li class="post">
<a href="15560194068510.html">resful 最佳实践</a>
</li>
<li class="post">
<a href="15554074466566.html">git 一些常用的命令</a>
</li>
<li class="post">
<a href="15553150635573.html">给clickhouse 物化视图增加字段</a>
</li>
<li class="post">
<a href="15548815336055.html">php相关函数</a>
</li>
<li class="post">
<a href="15543440484929.html">查看表占用磁盘空间大小</a>
</li>
</ul>
</section>
</aside> </div></div>
<footer role="contentinfo"><p>
Copyright © 2014 - -
<span class="credit">Powered by <a target="_blank" href="http://www.mweb.im">MWeb</a> Theme by <a href="http://octopress.org">Octopress</a></span>
</p>
</footer>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script><script type="text/x-mathjax-config">MathJax.Hub.Config({TeX: { equationNumbers: { autoNumber: "AMS" } }});</script>
</body>
</html>