Last active
August 29, 2015 14:10
-
-
Save fdwills/1136d33ab5ec30a2f298 to your computer and use it in GitHub Desktop.
Revisions
-
fdwills revised this gist
Dec 3, 2014 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -30,8 +30,8 @@ * pw_contact * pw_contact_request * pw_contact_note * pw_payment * pw_message * pw_block ### 2. peiwo_shard1, peiwo_shard2, peiwo_shard3系列数据库 @@ -42,11 +42,10 @@ * pw_event * pw_dialog * pw_push * pw_iap_error * pw_withdraw * pw_task * pw_call_ledger ## 新用户注册流程 -
fdwills revised this gist
Dec 2, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,14 +33,14 @@ * pw_message * pw_call_ledger * pw_block ### 2. peiwo_shard1, peiwo_shard2, peiwo_shard3系列数据库 #### 类别: 只有一个uid的表 * pw_user * pw_event * pw_dialog * pw_push * pw_payment * pw_iap_error -
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,13 +33,13 @@ * pw_message * pw_call_ledger * pw_block * pw_dialog ### 2. peiwo_shard1, peiwo_shard2, peiwo_shard3系列数据库 #### 类别: 只有一个uid的表 * pw_user * pw_event * pw_push * pw_payment -
fdwills revised this gist
Nov 27, 2014 . No changes.There are no files selected for viewing
-
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 10 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -57,4 +57,13 @@ 1. 按查找的数据类别,去common或者shard里面查找 2. 查找pw_user_shard表或redis 3. 去peiwo_shard#{shard_id}数据库里面查找数据 ## 上线移植 1. peiwo_common指向当前的peiwo-0的sneaky数据库 2. peiwo_shard1指向当前的peiwo-0的sneaky数据库 3. peiwo-1上新建数据库sneaky,peiwo_shard2指向该数据库 4. peiwo-2上新建数据库sneaky,peiwo_shard3指向该数据库 5. peiwo_common里建表pw_shard, 插入(1, 0), (2, 50), (3,50) 6. peiwo_common里建表pw_user_shard,将当前所有用户的shard_id设为1插入pw_user_shard中 -
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ #### 第二类: 有uid和tuid表 存储在common的好处是方便查询,后期partition * pw_contact * pw_contact_request -
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ 1. peiwo_common: 存储应用通用数据,存储user的shard数据,存储部分跨用户的数据 2. peiwo_shard#{1,2,3,4}系列: 主要存储用户数据,以uid分库。存储部分跨用户的数据 ### 1. peiwo_common数据库 #### 第一类: 存储无uid master表 @@ -34,7 +34,7 @@ * pw_call_ledger * pw_block ### 2. peiwo_shard1, peiwo_shard2, peiwo_shard3系列数据库 #### 类别: 只有一个uid的表 -
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,9 +3,9 @@ 1. peiwo_common: 存储应用通用数据,存储user的shard数据,存储部分跨用户的数据 2. peiwo_shard#{1,2,3,4}系列: 主要存储用户数据,以uid分库。存储部分跨用户的数据 ### peiwo_common数据库 #### 第一类: 存储无uid master表 * pw_shard @@ -23,7 +23,7 @@ * pw_captcha #### 第二类: 有uid和tuid表 存储在common的好处是方便查询 @@ -34,9 +34,9 @@ * pw_call_ledger * pw_block ### peiwo_shard1, peiwo_shard2, peiwo_shard3系列数据库 #### 类别: 只有一个uid的表 * pw_user * pw_dialog -
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ ## DB分库、分表 1. peiwo_common: 存储应用通用数据,存储user的shard数据,存储部分跨用户的数据 2. peiwo_shard#{1,2,3,4}系列: 主要存储用户数据,以uid分库。存储部分跨用户的数据 -
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -25,7 +25,7 @@ #### 第二类: 有uid和tuid 存储在common的好处是方便查询 * pw_contact * pw_contact_request -
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,9 +51,10 @@ ## 新用户注册流程 1. 查找pw_shard表,按权重随机选择shard_id 2. 将(uid, shard_id)写入pw_user_shard表或redis ## 用户数据读取 1. 按查找的数据类别,去common或者shard里面查找 2. 查找pw_user_shard表或redis 3. 去peiwo_shard#{shard_id}数据库里面查找数据 -
fdwills renamed this gist
Nov 27, 2014 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,6 +8,7 @@ #### 第一类: 无uid master数据 * pw_shard | column | 说明 | |--------|------| | id | shard_id | -
fdwills revised this gist
Nov 27, 2014 . 1 changed file with 24 additions and 20 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,26 +5,26 @@ ### peiwo_common #### 第一类: 无uid master数据 * pw_shard | column | 说明 | |--------|------| | id | shard_id | | weight | 权重 | * pw_user_shard | column | 说明 | |--------|------| | uid | pw_user表里的uid,用于shard的key | | shard_id | 此uid所属的shard | * pw_captcha #### 第二类: 有uid和tuid 方便查询 * pw_contact * pw_contact_request @@ -33,9 +33,9 @@ * pw_call_ledger * pw_block ### peiwo_shard1, peiwo_shard2, peiwo_shard3系列 #### 类别: 只有一个uid * pw_user * pw_dialog @@ -47,8 +47,12 @@ * pw_withdraw * pw_task ## 新用户注册流程 1. 查找pw_shard表,按权重随机选择shard_id 2. 将(uid, shard_id)写入pw_user_shard表 3. (uid, shard_id)写入redis ## 用户数据读取 -
fdwills revised this gist
Nov 26, 2014 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,7 +33,7 @@ * pw_call_ledger * pw_block ### peiwo_shard1, peiwo_shard2, peiwo_shard3... 只有一个uid -
fdwills revised this gist
Nov 26, 2014 . 1 changed file with 51 additions and 21 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,24 +1,54 @@ ## DB结构 1. peiwo_common: 存储应用通用数据,存储user的shard数据,存储部分跨用户的数据 2. peiwo_shard#{1,2,3,4}系列: 主要存储用户数据,以uid分库。存储部分跨用户的数据 ### peiwo_common 无uid * pw_shard ```json { 'id': int } ``` * pw_user_shard ``` { 'uid': int, 'shard_id': int } ``` * pw_captcha 有uid和tuid * pw_contact * pw_contact_request * pw_contact_note * pw_message * pw_call_ledger * pw_block ## peiwo_shard1, peiwo_shard2, peiwo_shard3... 只有一个uid * pw_user * pw_dialog * pw_event * pw_push * pw_payment * pw_iap_error * pw_reward * pw_withdraw * pw_task - 新用户注册 1. 查找pw_shard表 2. 随机选择shard_id 3. 将(uid, shard_id)写入pw_user_shard表 4. 以后所有的数据写入pw_shard#{shard_id}数据库 -
fdwills created this gist
Nov 26, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ ## peiwo_common pw_shard pw_user_shard pw_captcha pw_contact; pw_contact_request; pw_contact_note; pw_message; pw_dialog;; pw_event; pw_push; pw_payment; pw_iap_error; pw_reward; pw_withdraw; pw_call_ledger; pw_block; pw_task; ## peiwo_shard1, peiwo_shard2, peiwo_shard3... * pw_user: 用户表 *