码迷,mamicode.com
首页 > 数据库 > 详细

Mysql千万级大表同步复制的一些问题

时间:2015-08-18 11:48:05      阅读:925      评论:0      收藏:0      [点我收藏+]

标签:

 1 [root@iZ23eoaorbaZ ~]#   pt-online-schema-change  -u root -p xxxxxx -h localhost -A utf8 D=jinyuanbao,t=DistributionGoods --new-table-name DistributionGoods_0 --no-drop-trigger --no-swap-table --no-drop-new-table --execute
 2 No slaves found.  See --recursion-method if host iZ23eoaorbaZ has slaves.
 3 Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
 4 Operation, tries, wait:
 5   copy_rows, 10, 0.25
 6   create_triggers, 10, 1
 7   drop_triggers, 10, 1
 8   swap_tables, 10, 1
 9   update_foreign_keys, 10, 1
10 Altering `jinyuanbao`.`DistributionGoods`...
11 Creating new table...
12 Created new table jinyuanbao.DistributionGoods_0 OK.
13 2015-08-18T10:21:47 Creating triggers...
14 2015-08-18T10:21:47 Created triggers OK.
15 2015-08-18T10:21:47 Copying approximately 16259938 rows...
16 Copying `jinyuanbao`.`DistributionGoods`:   4% 11:05 remain
17 Copying `jinyuanbao`.`DistributionGoods`:   8% 11:18 remain
18 Copying `jinyuanbao`.`DistributionGoods`:  11% 12:02 remain
19 Copying `jinyuanbao`.`DistributionGoods`:  14% 12:16 remain
20 Copying `jinyuanbao`.`DistributionGoods`:  16% 12:18 remain
21 Copying `jinyuanbao`.`DistributionGoods`:  19% 12:25 remain
22 Copying `jinyuanbao`.`DistributionGoods`:  22% 12:05 remain
23 Copying `jinyuanbao`.`DistributionGoods`:  25% 11:44 remain
24 Copying `jinyuanbao`.`DistributionGoods`:  28% 11:07 remain
25 Copying `jinyuanbao`.`DistributionGoods`:  32% 10:27 remain
26 Copying `jinyuanbao`.`DistributionGoods`:  35% 09:50 remain
27 Copying `jinyuanbao`.`DistributionGoods`:  39% 09:13 remain
28 Copying `jinyuanbao`.`DistributionGoods`:  42% 08:37 remain
29 Copying `jinyuanbao`.`DistributionGoods`:  46% 08:02 remain
30 Copying `jinyuanbao`.`DistributionGoods`:  50% 07:27 remain
31 Copying `jinyuanbao`.`DistributionGoods`:  53% 06:54 remain
32 Copying `jinyuanbao`.`DistributionGoods`:  57% 06:24 remain
33 Copying `jinyuanbao`.`DistributionGoods`:  60% 05:51 remain
34 Copying `jinyuanbao`.`DistributionGoods`:  64% 05:19 remain
35 Copying `jinyuanbao`.`DistributionGoods`:  67% 04:47 remain
36 Copying `jinyuanbao`.`DistributionGoods`:  70% 04:19 remain
37 Copying `jinyuanbao`.`DistributionGoods`:  74% 03:48 remain
38 Copying `jinyuanbao`.`DistributionGoods`:  78% 03:14 remain
39 Copying `jinyuanbao`.`DistributionGoods`:  81% 02:47 remain
40 Copying `jinyuanbao`.`DistributionGoods`:  84% 02:18 remain
41 Copying `jinyuanbao`.`DistributionGoods`:  87% 01:48 remain
42 Copying `jinyuanbao`.`DistributionGoods`:  91% 01:18 remain
43 Copying `jinyuanbao`.`DistributionGoods`:  94% 00:48 remain
44 Copying `jinyuanbao`.`DistributionGoods`:  97% 00:20 remain
45 2015-08-18T10:38:03 Copied rows OK.
46 Not dropping old table because --no-drop-triggers was specified.
47 Not dropping triggers because --no-drop-triggers was specified.  To drop the triggers, execute:
48 DROP TRIGGER IF EXISTS `jinyuanbao`.`pt_osc_jinyuanbao_DistributionGoods_del`;
49 DROP TRIGGER IF EXISTS `jinyuanbao`.`pt_osc_jinyuanbao_DistributionGoods_upd`;
50 DROP TRIGGER IF EXISTS `jinyuanbao`.`pt_osc_jinyuanbao_DistributionGoods_ins`;
51 Not dropping the new table `jinyuanbao`.`DistributionGoods_0` because --no-drop-new-table was specified.  To drop the new table, execute:
52 DROP TABLE IF EXISTS `jinyuanbao`.`DistributionGoods_0`;
53 Successfully altered `jinyuanbao`.`DistributionGoods`.
54 [root@iZ23eoaorbaZ ~]#     pt-online-schema-change  -u root -p xxxxxxx -h localhost -A utf8 D=jinyuanbao,t=DistributionGoods_0 --new-table-name DistributionGoods_1 --no-drop-trigger --no-swap-table --no-drop-new-table --execute
55 No slaves found.  See --recursion-method if host iZ23eoaorbaZ has slaves.
56 Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
57 Operation, tries, wait:
58   copy_rows, 10, 0.25
59   create_triggers, 10, 1
60   drop_triggers, 10, 1
61   swap_tables, 10, 1
62   update_foreign_keys, 10, 1
63 Altering `jinyuanbao`.`DistributionGoods_0`...
64 Creating new table...
65 Created new table jinyuanbao.DistributionGoods_1 OK.
66 2015-08-18T10:46:06 Creating triggers...
67 2015-08-18T10:46:06 Created triggers OK.
68 2015-08-18T10:46:06 Copying approximately 16113957 rows...
69 Copying `jinyuanbao`.`DistributionGoods_0`:   4% 11:21 remain
70 Copying `jinyuanbao`.`DistributionGoods_0`:   8% 11:08 remain
71 Copying `jinyuanbao`.`DistributionGoods_0`:  12% 10:40 remain
72 Copying `jinyuanbao`.`DistributionGoods_0`:  16% 10:17 remain
73 Copying `jinyuanbao`.`DistributionGoods_0`:  19% 10:02 remain
74 Copying `jinyuanbao`.`DistributionGoods_0`:  23% 09:48 remain
75 Copying `jinyuanbao`.`DistributionGoods_0`:  27% 09:16 remain
76 Copying `jinyuanbao`.`DistributionGoods_0`:  30% 08:54 remain
77 Copying `jinyuanbao`.`DistributionGoods_0`:  34% 08:31 remain
78 Copying `jinyuanbao`.`DistributionGoods_0`:  37% 08:11 remain
79 Copying `jinyuanbao`.`DistributionGoods_0`:  41% 07:51 remain
80 Copying `jinyuanbao`.`DistributionGoods_0`:  44% 07:27 remain
81 Copying `jinyuanbao`.`DistributionGoods_0`:  48% 07:02 remain
82 Copying `jinyuanbao`.`DistributionGoods_0`:  51% 06:40 remain
83 Copying `jinyuanbao`.`DistributionGoods_0`:  54% 06:16 remain
84 Copying `jinyuanbao`.`DistributionGoods_0`:  58% 05:47 remain
85 Not dropping triggers because --no-drop-triggers was specified.  To drop the triggers, execute:
86 DROP TRIGGER IF EXISTS `jinyuanbao`.`pt_osc_jinyuanbao_DistributionGoods_0_del`;
87 DROP TRIGGER IF EXISTS `jinyuanbao`.`pt_osc_jinyuanbao_DistributionGoods_0_upd`;
88 DROP TRIGGER IF EXISTS `jinyuanbao`.`pt_osc_jinyuanbao_DistributionGoods_0_ins`;
89 Not dropping the new table `jinyuanbao`.`DistributionGoods_1` because --no-drop-new-table was specified.  To drop the new table, execute:
90 DROP TABLE IF EXISTS `jinyuanbao`.`DistributionGoods_1`;
91 `jinyuanbao`.`DistributionGoods_0` was not altered.
92 2015-08-18T10:54:31 Error copying rows from `jinyuanbao`.`DistributionGoods_0` to `jinyuanbao`.`DistributionGoods_1`: Threads_running=58 exceeds its critical threshold 50
2015-08-18T10:54:31 Error copying rows from `jinyuanbao`.`DistributionGoods_0` to `jinyuanbao`.`DistributionGoods_1`: Threads_running=58 exceeds its critical threshold 50
原始表2GB,复制出DistributionGoods_0,DistributionGoods_1表,依次安装触发器。
每次chunk操作前后,会根据show global status统计指定的状态量的变化,默认是统计Thread_running。
目的是为了安全,防止原始表上的触发器引起负载过高。这也是为了防止在线DDL对线上的影响。
超过设置的阀值,就会终止操作,在线DDL就会中断。提示的异常如上报错信息。

Mysql千万级大表同步复制的一些问题

标签:

原文地址:http://www.cnblogs.com/martinjinyu/p/4738890.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!