File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- <div align =" center " ><img width =" 100px " src =" http://dunwu.test.upcdn.net/images /others/zp.png!zp " /></div >
1+ <div align =" center " ><img width =" 100px " src =" http://dunwu.test.upcdn.net/cs /others/zp.png!zp " /></div >
22
33# DB Tutorial
44
Original file line number Diff line number Diff line change @@ -80,5 +80,5 @@ def main():
8080从事件处理的角度来看,服务器运行流程如下:
8181
8282<div align =" center " >
83- <img src =" http://dunwu.test.upcdn.net/images /database/redis/Redis事件的调度与执行.png!zp " />
83+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/Redis事件的调度与执行.png!zp " />
8484</div >
Original file line number Diff line number Diff line change @@ -242,7 +242,7 @@ Redis 的容灾备份基本上就是对数据进行备份,并将这些备份
242242### Redis 复制的启动过程
243243
244244<div align =" center " >
245- <img src =" http://dunwu.test.upcdn.net/images /database/redis/Redis复制启动过程.png!zp " width =" 400 " />
245+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/Redis复制启动过程.png!zp " width =" 400 " />
246246</div >
247247
248248当多个从服务器尝试连接同一个主服务器时:
Original file line number Diff line number Diff line change @@ -196,7 +196,7 @@ Redis 集群的重新分片操作由 Redis 集群管理软件 redis-trib 负责
196196重新分片的实现原理如下图所示:
197197
198198<div align =" center " >
199- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-cluster-trib.png!zp " width =" 400 " />
199+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-cluster-trib.png!zp " width =" 400 " />
200200</div >
201201
202202### ASK 错误
@@ -206,7 +206,7 @@ ASK 错误与 MOVED 的区别在于:**ASK 错误只是两个节点在迁移槽
206206判断 ASK 错误的过程如下图所示:
207207
208208<div align =" center " >
209- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-ask.png!zp " width =" 400 " />
209+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-ask.png!zp " width =" 400 " />
210210</div >
211211
212212### 复制
Original file line number Diff line number Diff line change 2121## STRING
2222
2323<div align =" center " >
24- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-string.png!zp " width =" 400 " />
24+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-string.png!zp " width =" 400 " />
2525</div >
2626
2727命令:
4848## LIST
4949
5050<div align =" center " >
51- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-list.png!zp " width =" 400 " />
51+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-list.png!zp " width =" 400 " />
5252</div >
5353
5454命令:
8585## SET
8686
8787<div align =" center " >
88- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-set.png!zp " width =" 400 " />
88+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-set.png!zp " width =" 400 " />
8989</div >
9090
9191命令:
132132## HASH
133133
134134<div align =" center " >
135- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-hash.png!zp " width =" 400 " />
135+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-hash.png!zp " width =" 400 " />
136136</div >
137137
138138命令:
183183## ZSET
184184
185185<div align =" center " >
186- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-zset.png!zp " width =" 400 " />
186+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-zset.png!zp " width =" 400 " />
187187</div >
188188
189189命令:
234234
235235## 参考资料
236236
237- 《Redis 设计与实现》
237+ 《Redis 设计与实现》
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ Redis 的复制功能分为同步和命令传播两个操作:
3535### 同步
3636
3737<div align =" center " >
38- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-sync.png!zp " width =" 400 " />
38+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-sync.png!zp " width =" 400 " />
3939</div >
4040
4141
@@ -80,7 +80,7 @@ Redis 的复制功能分为同步和命令传播两个操作:
8080它的工作原理是这样:** 主服务器端为复制流维护一个内存缓冲区(in-memory backlog)。主从服务器都维护一个复制偏移量(replication offset)和 master run id ,当连接断开时,从服务器会重新连接上主服务器,然后请求继续复制,假如主从服务器的两个 master run id 相同,并且指定的偏移量在内存缓冲区中还有效,复制就会从上次中断的点开始继续** 。如果其中一个条件不满足,就会进行完全重新同步(在 2.8 版本之前就是直接进行完全重新同步)。
8181
8282<div align =" center " >
83- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-replication-offset.png!zp " width =" 400 " />
83+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-replication-offset.png!zp " width =" 400 " />
8484</div >
8585
8686#### 复制偏移量
@@ -121,7 +121,7 @@ Redis 的复制功能分为同步和命令传播两个操作:
121121### PSYNC 命令的实现
122122
123123<div align =" center " >
124- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-psync-workflow.png!zp " width =" 400 " />
124+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-psync-workflow.png!zp " width =" 400 " />
125125</div >
126126
127127## 复制的实现
Original file line number Diff line number Diff line change @@ -96,7 +96,7 @@ Redis 与 Memcached 因为都可以用于缓存,所以常常被拿来做比较
9696### 2.1. STRING
9797
9898<div align =" center " >
99- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-string.png!zp " width =" 400 " />
99+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-string.png!zp " width =" 400 " />
100100</div >
101101
102102命令:
123123### 2.2. LIST
124124
125125<div align =" center " >
126- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-list.png!zp " width =" 400 " />
126+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-list.png!zp " width =" 400 " />
127127</div >
128128
129129命令:
160160### 2.3. SET
161161
162162<div align =" center " >
163- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-set.png!zp " width =" 400 " />
163+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-set.png!zp " width =" 400 " />
164164</div >
165165
166166命令:
207207### 2.4. HASH
208208
209209<div align =" center " >
210- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-hash.png!zp " width =" 400 " />
210+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-hash.png!zp " width =" 400 " />
211211</div >
212212
213213命令:
258258### 2.5. ZSET
259259
260260<div align =" center " >
261- <img src =" http://dunwu.test.upcdn.net/images /database/redis/redis-datatype-zset.png!zp " width =" 400 " />
261+ <img src =" http://dunwu.test.upcdn.net/cs /database/redis/redis-datatype-zset.png!zp " width =" 400 " />
262262</div >
263263
264264命令:
Original file line number Diff line number Diff line change @@ -27,11 +27,11 @@ H2 允许用户通过浏览器接口方式访问 SQL 数据库。
27272 . 启动方式:在 bin 目录下,双击 jar 包;执行 ` java -jar h2*.jar ` ;执行脚本:` h2.bat ` 或 ` h2.sh ` 。
28283 . 在浏览器中访问:http://localhost:8082,应该可以看到下图中的页面:
2929
30- <br ><div align =" center " ><img src =" http://dunwu.test.upcdn.net/images /database/h2/h2-console.png!zp " /></div ><br >
30+ <br ><div align =" center " ><img src =" http://dunwu.test.upcdn.net/cs /database/h2/h2-console.png!zp " /></div ><br >
3131
3232点击 ** Connect** ,可以进入操作界面:
3333
34- <br ><div align =" center " ><img src =" http://dunwu.test.upcdn.net/images /database/h2/h2-console-02.png!zp " /></div ><br >
34+ <br ><div align =" center " ><img src =" http://dunwu.test.upcdn.net/cs /database/h2/h2-console-02.png!zp " /></div ><br >
3535
3636操作界面十分简单,不一一细说。
3737
Original file line number Diff line number Diff line change @@ -406,7 +406,7 @@ migrations 最常用的编写形式就是 SQL。
406406
407407为了被 Flyway 自动识别,SQL migrations 的文件命名必须遵循规定的模式:
408408
409- <br ><div align =" center " ><img src =" http://dunwu.test.upcdn.net/images /database/flyway/sql-migrations.png!zp " /></div ><br >
409+ <br ><div align =" center " ><img src =" http://dunwu.test.upcdn.net/cs /database/flyway/sql-migrations.png!zp " /></div ><br >
410410
411411- ** Prefix** - ` V ` 代表 versioned migrations (可配置), ` U ` 代表 undo migrations (可配置)、 ` R ` 代表 repeatable migrations (可配置)
412412- ** Version** - 版本号通过` . ` (点)或` _ ` (下划线)分隔 (repeatable migrations 不需要)
@@ -425,7 +425,7 @@ migrations 最常用的编写形式就是 SQL。
425425
426426为了被 Flyway 自动识别,JAVA migrations 的文件命名必须遵循规定的模式:
427427
428- <br ><div align =" center " ><img src =" http://dunwu.test.upcdn.net/images /database/flyway/java-migrations.png!zp " /></div ><br >
428+ <br ><div align =" center " ><img src =" http://dunwu.test.upcdn.net/cs /database/flyway/java-migrations.png!zp " /></div ><br >
429429
430430- ** Prefix** - ` V ` 代表 versioned migrations (可配置), ` U ` 代表 undo migrations (可配置)、 ` R ` 代表 repeatable migrations (可配置)
431431- ** Version** - 版本号通过` . ` (点)或` _ ` (下划线)分隔 (repeatable migrations 不需要)
Original file line number Diff line number Diff line change @@ -531,7 +531,7 @@ Mysql 支持两种复制:基于行的复制和基于语句的复制。
531531- ** SQL 线程** :负责读取中继日志并重放其中的 SQL 语句。
532532
533533<div align =" center " >
534- <img src =" http://dunwu.test.upcdn.net/images /database/mysql/master-slave.png!zp " />
534+ <img src =" http://dunwu.test.upcdn.net/cs /database/mysql/master-slave.png!zp " />
535535</div >
536536
537537### 7.2. 读写分离
@@ -547,7 +547,7 @@ MySQL 读写分离能提高性能的原因在于:
547547- 增加冗余,提高可用性。
548548
549549<div align =" center " >
550- <img src =" http://dunwu.test.upcdn.net/images /database/mysql/master-slave-proxy.png!zp " />
550+ <img src =" http://dunwu.test.upcdn.net/cs /database/mysql/master-slave-proxy.png!zp " />
551551</div >
552552
553553## 8. 参考资料
You can’t perform that action at this time.
0 commit comments