• mysqldump中master-data和dump-slave的区别


     
    [mysql@db2 ~]$ mysqldump -A --master-data=2 > master2.sql

    [mysql@db2 ~]$ mysqldump -A --dump-slave=2 > slave2.sql

    [mysql@db2 ~]$ mysqldump -A --master-data=1 > master1.sql

    [mysql@db2 ~]$ mysqldump -A --dump-slave=1 > slave1.sql
    [mysql@db2 ~]$ diff master2.sql master1.sql
    
    22c22
    < -- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin2.000001', MASTER_LOG_POS=259;
    ---
    > CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin2.000001', MASTER_LOG_POS=335;
    845c845
    < -- Dump completed on 2012-03-13 18:09:46
    ---
    > -- Dump completed on 2012-03-13 18:10:17
    [mysql@db2 ~]$ diff slave2.sql slave1.sql
    22c22
    < -- CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000007', MASTER_LOG_POS=107;
    ---
    > CHANGE MASTER TO MASTER_LOG_FILE='mysql-bin.000007', MASTER_LOG_POS=107;
    845c845
    < -- Dump completed on 2012-03-13 18:09:59
    ---
    > -- Dump completed on 2012-03-13 18:10:24
    有上可知:
    A. =1和=2的区别很明显,只是自动执行和手工执行的区别
    B. --master-data用于在master端dump数据,用于建立slave
    --dump-slave用户在slave端dump数据,建立新的slave,至少是第2个slave,也就是已经有A-->B,现在从B上导出数据建立A-->C的复制

    这个不但可以用于建立slave,还可用于备份中,用于读binlog进行roll forward的起点

      

    注意:

    --master-data, It turns on --lock-all-tables, unless single-transaction also is specified

  • 相关阅读:
    泛型
    hibernate--lazy(懒加载)属性
    hibernate--关联映射(一对多)
    hibernate--关联映射(多对一,一对一)
    Hibernate--基本映射标签和属性介绍
    hibernate--query接口初步
    java多线程学习--java.util.concurrent
    git 忽略文件 目录
    spring boot 扫描 其他jar包里面的 mapper xml
    windows gogs 安装
  • 原文地址:https://www.cnblogs.com/zengkefu/p/5690131.html
Copyright © 2020-2023  润新知