renard
renard

Reputation: 1468

How to re-sync only one slave Mysql DB in case of mysql replication

I've seen this post to re-synchronize a slave database when only one slave is connected to a master DB.

If I understood well, this solution is not the best when we need to resynchronize only 1 slave DB out of batch of slave DBs.

Is there a way to do this, without having to resynchronize all the slave DBs connected to the master ? I guess the RESET MASTER would affect all the slave DBs state and would lead to resynchronize all of them.

Thank you for your help

Cheers

Upvotes: 0

Views: 1851

Answers (2)

user3069488
user3069488

Reputation: 85

What in that case with rest of your DBs? If you change binlog and position will they be up to date?

Regards Robert

Upvotes: 0

renard
renard

Reputation: 1468

I found the solution using these mysqldump option to avoid using RESET MASTER way :

mysqldump -p --skip-lock-tables --single-transaction --flush-logs --hex-blob --master-data=2 <dbname> > /tmp/<dbname>.sql

This way, the master log bin and position are not changed, but just added on top of the file .sql.

If you set master-data=2 they will be commented in the file

If you set master-data=1 they will not be commented in the file

Once your dump is on your slave host you can reset the slave, import your dump and then run the mysql command change master to MASTER_LOG_FILE='mysqld-bin.xxxxxxx',MASTER_LOG_POS=xxxx; with the values indicated in the top of your dump file.

Cheers

Upvotes: 1

Related Questions