-
Notifications
You must be signed in to change notification settings - Fork 2
fix unreasonable eefocus user ids
donglijun edited this page Jun 6, 2018
·
14 revisions
https://github.com/eefocus/DevOps/tree/master/scripts/eefocus-user
.
├── 1-drop-foreign-key.php
├── 2-build-id-map.php
├── 3-update-user-id.php
├── 4-reset-auto_increment.php
├── 5-fix-bbs.php
├── 6-fix-special-data.php
├── batch-update-user-id.sh
├── conf
│ ├── db.php
│ ├── foreign-keys.php
│ ├── id-fields.php
│ └── special-data.php
├── data
├── lib
│ └── func.php
└── log
# 去除`摩尔吧`和`电路城`数据库中跟用户id有关的外键
php 1-drop-foreign-key.php
# 从用户中心的表中查出所有不正常的大用户id,并匹配正常的用户自增id,结果保存到csv文件
# 如果生成过测试数据,正式执行前需要先删除,避免收集的用户id不全
#rm -f data/id-map.csv
php 2-build-id-map.php
# 读取csv保存的用户id对应关系,更新所有数据库中跟用户id有关的字段
#php 3-update-user-id.php >log/3.log
# 并行处理脚本,每个数据库启动一个进程,以提高处理效率
sh batch-update-user-id.sh
# 重置用户中心表的自增长id
php 4-reset-auto_increment.php
# 修复bbs中产生的极值uid用户,尝试替换成正常的uid
php 5-fix-bbs.php >log/5.log
# 修复一些特殊的数据
php 6-fix-special-data.php
脚本3-update-user-id.php
和5-fix-bbs.php
会输出大量日志,最好重定向到文件保存
清理了异常数据,部分数据存在id冲突,需要手工处理
总数1086
,最大id999000051
库 | 表 | 字段 | 值 | 备注 |
---|---|---|---|---|
cirmall | topic_invite | inviter_id | 2147483647 | |
cirmall | user_draw_times_common | user_id | 2147483647 | |
eefocus-account | eef_core_user_data | uid | 123999999 | |
eefocus-community-atmel | eef_member_profile | uid | 4000064 | |
eefocus-community-atmel | eef_member_profile | uid | 4000065 | |
eefocus-main | eef_activity_tek_ans | inviter_id | 43170 | 错误使用varchar 字段,应该为int
|
eefocus-main | eef_member_member | uid | 4000028 | |
eefocus-main | eef_member_member | uid | 4000030 | |
eefocus-main | eef_member_member | uid | 4000031 | |
eefocus-main | eef_member_member | uid | 4000033 | |
eefocus-main | eef_member_member | uid | 4000036 | |
eefocus-main | eef_member_member | uid | 4000039 | |
eefocus-main | eef_member_profile | uid | 4000028 | |
eefocus-main | eef_member_profile | uid | 4000030 | |
eefocus-main | eef_member_profile | uid | 4000031 | |
eefocus-main | eef_member_profile | uid | 4000033 | |
eefocus-main | eef_member_profile | uid | 4000036 | |
eefocus-main | eef_member_profile | uid | 4000039 | |
moore8 | member | user_id | 123999999 | 实际用户是admin ,uid应该为1 |
moore8 | notification | user_id | 123999999 | 实际用户是admin ,uid应该为1 |
moore8 | user_coupon | user_id | 123999999 | 实际用户是admin ,uid应该为1 |
库 | 表 | 字段 | 值 | 备注 |
---|---|---|---|---|
eefocus-community-analog | eef_member_profile | uid | 3483175 | |
eefocus-community-st | eef_member_profile | uid | 3483175 |
[2018-05-31 21:53:43][INFO] Found current max user id: 3484575
[2018-05-31 21:56:02][INFO] Reset auto_increment: 3484576
只有ams社区论坛没有产生极值用户