之前使用 pt-online-schema-change添加索引没有问题,如下语句
[root@ixxxxxx ~]# pt-online-schema-change --no-version-check --execute --alter-foreign-keys-method=auto --alter "add key idx_namer(col)" h=xx,P=3306,u=ybl_all,p='xx',D=db,t=table_name
No slaves found. See --recursion-method if host h=xx,P=3306 has slaves.
Not checking slave lag because no slaves were found and --check-slave-lag was not specified.
Operation, tries, wait:
analyze_table, 10, 1
copy_rows, 10, 0.25
create_triggers, 10, 1
drop_triggers, 10, 1
swap_tables, 10, 1
update_foreign_keys, 10, 1
Child tables:
`tt`.`xx` (approx. 1 rows)
Will automatically choose the method to update foreign keys.
Altering `tt`.`xx`...
Creating new table...
Created new table tt._xx_new OK.
Altering new table...
Altered `tt`.`xx_new` OK.
2018-03-24T11:14:14 Creating triggers...
2018-03-24T11:14:14 Created triggers OK.
2018-03-24T11:14:14 Copying approximately 269851 rows...
2018-03-24T11:14:33 Copied rows OK.
2018-03-24T11:14:33 Max rows for the rebuild_constraints method: 29608
Determining the method to update foreign keys...
2018-03-24T11:14:33 Analyzing new table...
2018-03-24T11:14:33 Swapping tables...
2018-03-24T11:14:33 Swapped original and new tables OK.
2018-03-24T11:14:33 Rebuilding foreign key constraints...
2018-03-24T11:14:33 Rebuilt foreign key constraints OK.
2018-03-24T11:14:33 Dropping old table...
2018-03-24T11:14:34 Dropped old table `tt`.`xx` OK.
2018-03-24T11:14:34 Dropping triggers...
2018-03-24T11:14:34 Dropped triggers OK.
Successfully altered `ybl_ucs`.`ucs_account`.
[root@xx ~]#
今天再次使用时添加索引没有反应,卡在哪里
分析现在架构是rds + ecs 自建mysql 备库
尝试停到ecs自建mysql 的复制
stop slave
在次添加索引,就可以了
最后启动备份复制进程
start slave
新增的索引备库应用成功