zoukankan      html  css  js  c++  java
  • MySQL复制(三):常见的复制任务

    复制案例:包括横向扩展、热备

    报表

    企业需要挖掘有价值的报表信息,使用SLAVE,可以避免干扰到master的复制。

    通过binlog获取某个时间范围的所有事件

    $ mysqlbinlog --force --read-from-remote-server --host=reporting.bigcorp.com 
    > --start-datetime='2009-09-25 23:55:00'
    > --stop-datetime='2009-09-25 23:59:59' 
    > binlog files
    

    如果正在写二进制日志的,需要提供--force选型,否则mysqlbinlog无法读取已经打开的二进制日志。

    /*!40019 SET @@session.max_insert_delayed_threads=0*/;
    /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
    DELIMITER /*!*/;
    # at 4
    #090909 22:16:25 server id 1 end_log_pos 106 Start: binlog v 4, server v...
    ROLLBACK/*!*/;
    .
    .
    .
    # at 2495
    #090929 23:58:36 server id 1 end_log_pos 2650 Query thread_id=27 exe...
    SET TIMESTAMP=1254213690/*!*/;
    SET /*!*/;
    INSERT INTO message_board(user, message)
    VALUES ('mats@sun.com', 'Midnight, and I'm bored')
    /*!*/;
    

     分析完毕之后,在通过

    report> START SLAVE UNTIL
    -> MASTER_LOG_POS='capulet-bin.000004',
    -> MASTER_LOG_POS=2650;
    Query OK, 0 rows affected (0.18 sec)
    

      

     

  • 相关阅读:
    Stepping Number
    Replace String
    String Permutation
    Clock Angle
    Keypad Permutation
    Replace Words
    1、奉加微 PHY6202 Get started
    Python3 修改二进制文件
    Google Fast Pair
    python 校验 BLE resolvable private address
  • 原文地址:https://www.cnblogs.com/olinux/p/6565231.html
Copyright © 2011-2022 走看看