percona-toolkit
1.添加字段报错1:
报错信息解决方法:
yum -y install perl-Time*
2.不能连接数据库报错:
报错信息 报错信息解决方法:见图片中----
CENTOS:yum install perl-DBD-MySQL perl-DBI -y
插入信息反馈:
[root@localhost bin]# ./pt-online-schema-change --user=root -p123456 --host=127.0.0.1 --alter='ADD COLUMN age int' D=test,t=info --execute
No slaves found. See --recursion-method if host localhost.localdomain 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
Altering `test`.`info`...
Creating new table...
Created new table test._info_new OK.
Altering new table...
Altered `test`.`_info_new` OK.
2019-12-19T17:13:49 Creating triggers...
2019-12-19T17:13:49 Created triggers OK.
2019-12-19T17:13:49 Copying approximately 2 rows...
2019-12-19T17:13:49 Copied rows OK.
2019-12-19T17:13:49 Swapping tables...
2019-12-19T17:13:49 Swapped original and new tables OK.
2019-12-19T17:13:49 Dropping old table...
2019-12-19T17:13:50 Dropped old table `test`.`_info_old` OK.
2019-12-19T17:13:50 Dropping triggers...
2019-12-19T17:13:50 Dropped triggers OK.
Successfully altered `test`.`info`.
2.pt-table-checksum工具会在主上建表,如果同步不到从数据库的话会报错
报错信息问题出在checksums 表在从库不存在
解决方法:
将master上的checksums表的数据结构复制下来,到从上相应的数据库下面创建该表,在执行命令就可以了
3.如果存在一主多从的状态,主库不能自动发现从库、主从检测连接用户信息不一样,都可以使用dsns指定备库
解决方法:
1)创建表结构:
CREATE TABLE dsns (id int(11) NOT NULL AUTO_INCREMENT,parent_id int(11) DEFAULT NULL,dsn varchar(255) NOT NULL,PRIMARY KEY (id));
2)配置从库的dsn信息:
insert into dsns(dsn) values('h=从IP地址,P=3306,u=用户名,p=密码');
3)使用:
./pt-table-checksum --nocheck-replication-filters --no-check-binlog-format --replicate=test.checksums --databases=db_ljlj h=192.168.11.230,u=ptuser,p=123456,P=3306 --recursion-method dsn=h=192.168.9.178,ptuser,p=123456,P=3306,D=test,t=dsns