17.1.1.4 Obtaining the Replication Master Binary Log Coordinates  得到复制master binary log 位置:

你需要master的当前坐标在他的Binary log 为了配置slave slave开始复制处理在合适的点:

如果你已经有存在的数据在你的master上,你需要同步你的slaves 在开始复制过程前,

你必须停止处理语句在master上,然后得到他的当前的binary log 位置和dump 它的数据,

在运行master 继续执行语句前。 如果你不停止语句的执行,data dump和master status信息你使用的不会匹配 你会借宿不一致性或者冲突的数据库在slave上

要获得master binary log 位置信息,遵循下面的步骤:

1.开始一个session 在master 上通过连接它,flush 所有的表和block 写语句通过执行FLUSH TABLES WITH READ LOCK statement:

mysql> FLUSH TABLES WITH READ LOCK;

对于InnoDB 表, FLUSH TABLES WITH READ LOCK 也堵塞COMMIT 操作

警告:

  留着客户端 你执行e FLUSH TABLES statement  运行这样 read lock仍然有效,如果你退出client,lock是被释放:

2.在master 的另外一个session,使用SHOW MASTER STATUS 语句来得到当前的binary log 文件名字和位置:

mysql>  SHOW MASTER STATUS;
+------------------+-----------+--------------+------------------+-------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB | Executed_Gtid_Set |
+------------------+-----------+--------------+------------------+-------------------+
| mysql-bin.000016 | 399962594 | | | |
+------------------+-----------+--------------+------------------+-------------------+
1 row in set (0.00 sec) mysql > SHOW MASTER STATUS;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000003 | 73 | test | manual,mysql |
+------------------+----------+--------------+------------------+ 文件列显示 log file 的名字 Position 显示file 的位置。 在这个例子中,binary log 文件是mysql-bin.000003 和 position 是73. 记录那些值, 你随后需要它们当你设置slave的时候。 它们代表复制坐标 slave 应该开始处理新的更新从master 如果master 先前运行没有启用 binary logging, log file name 和position 通过SHOW MASTER STATUS 显示 或者mysqldump --master-data 会是空的。 你现在有信息你需要让slave开始读取从binary log 在正确的位置开始复制

17.1.1.4 Obtaining the Replication Master Binary Log Coordinates 得到复制master binary log 位置:的更多相关文章

  1. 17.1.1.4 Obtaining the Replication Master Binary Log Coordinates 获取复制Master Binary Log的坐标:

    17.1.1.4 Obtaining the Replication Master Binary Log Coordinates 获取复制Master Binary Log的坐标: 你需要master ...

  2. 17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制使用新的master和slaves:

    17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制使用新的master和slaves: 最简单和最直接方式是设置复制使用新的 ...

  3. 17.1.1.1 Setting the Replication Master Configuration 设置复制的master 配置:

    17.1.1.1 Setting the Replication Master Configuration 设置复制的master 配置: 在一个复制master,你必须启用binary loggin ...

  4. 17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制对于新的Master和Slaves:

    17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制对于新的Master和Slaves: 最简单和最直接的方法是设置复制用于使 ...

  5. 17.1.4 Replication and Binary Logging Options and Variables 复制和Binary logging 选项和变量

    17.1.4 Replication and Binary Logging Options and Variables 复制和Binary logging 选项和变量 下面的章节包含信息关于mysql ...

  6. 17.1.2.1 Advantages and Disadvantages of Statement-Based and Row-Based Replication 基于语句和行的复制的优势和劣势

    17.1.2.1 Advantages and Disadvantages of Statement-Based and Row-Based Replication 基于语句和行的复制的优势和劣势 每 ...

  7. 17.1.1.2 Setting the Replication Slave Configuration

    17.1.1.2 Setting the Replication Slave Configuration 在一个复制slave, 你必须创建一个唯一的server ID,如果这个没有做,slave设置 ...

  8. 17.1.1.8?Setting Up Replication with Existing Data设置复制使用存在的数据

    17.1.1.8?Setting Up Replication with Existing Data设置复制使用存在的数据 当设置复制使用存在的数据,你需要确定如何最好的从master 得到数据到sl ...

  9. RocketMQ初探(五)之RocketMQ4.2.6集群部署(单Master+双Master+2m+2s+async异步复制)

    以下部署方式结合众多博友的博客,经过自己一步一步实际搭建,如有雷同,侵权行为,请见谅...其中遇到不少的坑,希望能帮到更多的人,现在很少能找到一份完整版4.2.6版本的搭建教程了,如果你有幸遇见,那么 ...

随机推荐

  1. JBPM WEB CONSOLE安装实录

    http://www.blogjava.net/paulwong/archive/2009/03/13/259551.html JBPM WEB CONSOLE是一个B/S端的,能管理JBPM的流程和 ...

  2. c语言学习之基础知识点介绍(十九):内存操作函数

    一.malloc函数 /* 首先需要导入头文件 #include <stdlib.h> malloc void* malloc(n); n是字节大小 开辟堆空间,开辟的字节数以n为准 返回 ...

  3. 完全备份ORACLE数据库 并在另一台电脑上恢复

    由于最近有oracle的项目,需要把数据库在另外一台电脑里面配置一个一样的数据库用来测试开发用,之前是一直使用mssql,只需要附加或者还原就行,但是在oracle里面,就没有这么简单,但是也不难,操 ...

  4. Http上传文件

    public class UpLoadFile { public static void UpLoadFiles(string fileName) { string fileType = Path.G ...

  5. Batch file Functions

    Quote from: http://ss64.com/nt/syntax-functions.html Batch file Functions Packaging up code into a d ...

  6. c++ fstream中seekg()和seekp()的用法

    转自:http://blog.sina.com.cn/s/blog_679f85d40100mysi.html 先说一下C语言中fseek()的功能: 函数原型:int fseek(FILE *fp, ...

  7. linux - 创建用户

    apt-get update apt-get upgrade root@iZ28t2p7lz9Z:~# adduser cuiAdding user `cui' ...Adding new group ...

  8. 【实习记】2014-09-24万事达卡bin查询项目总结

            8月28号,接到这个问题:现有前缀查询速度较慢,改进此知值求区间问题. 一开始没想到用二分法,更没有想到这个项目用了一个月,这一个月里,我学习并使用了middle框架写出了server ...

  9. Linux网络应用编程之集线器(Packet Tracer仿真)

    Packet Tracer入门 一,集线器概况 对接收到的信号进行再生整形放大,以扩大网络的传输距离,同时把所有节点集中在以它为中心的节点上. 工作于OSI(开放式系统互联参考模型)的最底层(物理层) ...

  10. css3动画使用技巧之——transform-delay为负值时的应用。

    <html>    <head>        <title>css3动画delay为负值时的效果</title>        <meta ch ...