gatorreina
gatorreina

Reputation: 960

Restoring mysql dump on a master

I have a master which is replicated by five slaves. I need to restore a database on the master and plan to do so with mysql db_name < db_name.dump. My question is do I need to stop mysql on the master before I do so for the slaves to automatically pick up the changes? If so what commands must I execute before doing mysql db_name < db_name.dump ?

Upvotes: 1

Views: 964

Answers (1)

Bill Karwin
Bill Karwin

Reputation: 562320

Here's what happens:

  1. The master runs all the changes in the dump file (mostly CREATE TABLE and INSERT statements).
  2. The master logs all those changes in its binary log.
  3. Each replica downloads the binary log from the master.
  4. Each replica replays the same changes.

You don't need to stop anything. All the replicas will replicate the changes, as long as you have configured replication correctly.

Upvotes: 2

Related Questions