简体   繁体   English

在主数据库上还原mysql dump

[英]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. 我需要在主数据库上还原数据库,并计划使用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? 我的问题是我需要在主机上停止mysql之前,以便从机自动获取更改吗? If so what commands must I execute before doing mysql db_name < db_name.dump ? 如果是这样,在执行mysql db_name <db_name.dump之前,我必须执行哪些命令?

Here's what happens: 这是发生了什么:

  1. The master runs all the changes in the dump file (mostly CREATE TABLE and INSERT statements). 主服务器运行转储文件中的所有更改(主要是CREATE TABLE和INSERT语句)。
  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. 只要您已正确配置复制,所有副本将复制更改。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM