Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Restore part of the table on the slave slave computer

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following example demonstrates reinitializing individual tables on slave, such as test01 and test02.

1. Stop slave replication

Click (here) to collapse or open

Mysql > stop slave

Query OK, 0 rows affected (0.02 sec) 2. Export this table in master and record the synchronized binlog and POS points

Mysqldump-uroot-pmysql-Q-single-- master-data=2 test test01 test02 > test_01_test_02.sql

3. Check the test_01_test_02.sql file to find the recorded binlog and POS points

MASTER_LOG_FILE='mysql-bin.000003', MASTER_LOG_POS=3407

4. Copy test_01_test_02.sql to slave and point to change master.

Click (here) to collapse or open

Mysql > start slave until master_log_file='mysql-bin.000003', MASTER_LOG_POS=3407

Query OK, 0 rows affected, 1 warning (0.01 sec) until sql_ thread is NO, all synchronization errors can be skipped, and can be skipped with the following command:

Stop slave

Set global sql_slave_skip_counter=1

Start slave

5. Import on slave

Click (here) to collapse or open

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.01sec)

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.01sec)

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) 6. After the import is completed, you can enable synchronization.

Click (here) to collapse or open

Mysql > start slave

Query OK, 0 rows affected (0.01 sec)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report