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. JVM内存模型及垃圾回收机制

    http://blog.csdn.net/zhangpengju999/article/details/11773183 JVM垃圾回收机制 分代垃圾回收 不同的对象生命周期不同.与业务信息有关的对象 ...

  2. nyoj89 汉诺塔(二)

    题目网址 :http://acm.nyist.net/JudgeOnline/problem.php?pid=89 汉诺塔问题的经典结论: 把i个盘子从一个柱子整体移到另一个柱子最少需要步数是 2的i ...

  3. /etc/resolv.conf文件详解

    大家好,今天51开源给大家介绍一个在配置文件,那就是/etc/resolv.conf.很多网友对此文件的用处不太了解.其实并不复杂,它是DNS客户机配置文件,用于设置DNS服务器的IP地址及DNS域名 ...

  4. V$SESSION_LONGOPS

    对大部分DBA来说,V$SESSION_LONGOPS视图都不会陌生,以前在面试的时候,也有一些企业会问到如何查询数据库中运行时间比较长的SQL,就可以通过这个视图来查看.V$SESSION_LONG ...

  5. Javascript中数组方法汇总

    Array.prototype中定义了很多操作数组的方法,下面介绍ECMAScript3中的一些方法: 1.Array.join()方法 该方法将数组中的元素都转化为字符串并按照指定符号连接到一起,返 ...

  6. Socket 死连接详解

    Socket 死连接详解 当使用 Socket 进行通信时,由于各种不同的因素,都有可能导致死连接停留在服务器端,假如服务端需要处理的连接较多,就有可能造成服务器资源严重浪费,对此,本文将阐述其原理以 ...

  7. 网站开发常用jQuery插件总结(八)标签编辑插件Tagit

    一.Tagit插件功能 提高网站交互性,增加用户体验.至于其它的功能,还真没有.用一个input text就可以替换了它.但是text没有输入提示功能,而tagit拥有这个功能.官方示例如下图: 将关 ...

  8. tomcat配置虚拟目录的步骤

    1.在tomcat中.....\conf\Catalina\localhost中创建一个test.xml文件 2.然后在\conf的server.xml中的 <Host > 元素里面 添加 ...

  9. ubuntu下php开发环境搭建,nginx+(cgi)php5fpm+memcached+xdebug

    由于只是开发环境,所以都是选择比较简单的apt-get安装方式 ,但中间也遇到一点问题. 首先安装nginx nginx的安装和配置其实很简单,nginx本身非常轻量级, 直接 sudo apt-ge ...

  10. TDirectory.Move移动或更名目录

    使用函数: System.IOUtils.TDirectory.Move 定义: class procedure Move(const SourceDirName, DestDirName: stri ...