恢复slave从机上的部分表
以下案例演示重新初始化slave上的个别表,如test01和test02.
1、停止slave复制
2、在master导出这张表,并记录下同步的binlog和POS点
mysqldump -uroot -pmysql -q --single --master-data=2 test test01 test02 > test_01_test_02.sql
3、查看test_01_test_02.sql文件,找到记录的binlog和POS点
MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=3407;
4、把test_01_test_02.sql复制到slave上,并做change master指向
直到sql_thread线程为NO,这期间的同步报错一律跳过即可,可用如下命令跳过:
stop slave;
set global sql_slave_skip_counter=1;
start slave;
5、在slave上导入
6、导入完毕之后,开启同步即可。
分享标题:恢复slave从机上的部分表
标题网址:http://pwwzsj.com/article/iejjsp.html
1、停止slave复制
点击(此处)折叠或打开
在顺平等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供成都网站设计、成都网站建设 网站设计制作定制网站制作,公司网站建设,企业网站建设,品牌网站建设,成都营销网站建设,外贸网站制作,顺平网站建设费用合理。
-
MySQL> stop slave;
- Query OK, 0 rows affected (0.02 sec)
mysqldump -uroot -pmysql -q --single --master-data=2 test test01 test02 > test_01_test_02.sql
3、查看test_01_test_02.sql文件,找到记录的binlog和POS点
MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=3407;
4、把test_01_test_02.sql复制到slave上,并做change master指向
点击(此处)折叠或打开
-
mysql> start slave until master_log_file='mysql-bin.000003', MASTER_LOG_POS=3407;
- Query OK, 0 rows affected, 1 warning (0.01 sec)
stop slave;
set global sql_slave_skip_counter=1;
start slave;
5、在slave上导入
点击(此处)折叠或打开
-
mysql> source /mysql/dump/test_01_test_02.sql
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.04 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.04 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 6 rows affected (0.01 sec)
-
Records: 6 Duplicates: 0 Warnings: 0
-
-
Query OK, 0 rows affected (0.01 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.06 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.07 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 6 rows affected (0.01 sec)
-
Records: 6 Duplicates: 0 Warnings: 0
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
-
Query OK, 0 rows affected (0.00 sec)
-
- Query OK, 0 rows affected (0.00 sec)
点击(此处)折叠或打开
-
mysql> start slave;
- Query OK, 0 rows affected (0.01 sec)
分享标题:恢复slave从机上的部分表
标题网址:http://pwwzsj.com/article/iejjsp.html