zoukankan      html  css  js  c++  java
  • perl 分析mysql binlog

    binlog 日志格式:
    
    use `zjzc`/*!*/;
    SET TIMESTAMP=1476326343/*!*/;
    UPDATE `ProductAccess` pa SET pa.accessType =1 WHERE  pa.productSn IN(
    
    SET TIMESTAMP=1476326807/*!*/;
    update ClientActionTrack set
    
    SET TIMESTAMP=1476327571/*!*/;
    UPDATE `zjzc`.`scan` SET `sn`='200' WHERE `sn`='100'
    
    
    [root@zjzc01 binlog]# cat binlog.pl 
    if ( $#ARGV < 2 ){  
            print "please input file  update|insert table_namee!
    ";  
            exit(-1);  
    
                   }; 
    my $a=$ARGV[0];
    my $b=$ARGV[1];
    my $c=$ARGV[2];
    local $/='/*!*/;';
    open (A,"<","$a");
         while (<A>){
          if  (( $_ =~/$bs+$c/i ) or ($_ =~/$bs+`$c`/i) ){
          print $_;
            };
          };
     
    [root@zjzc01 binlog]# perl binlog.pl aa UPDATE scan
    [root@zjzc01 binlog]# 
    [root@zjzc01 binlog]# 
    
    
    /*!*/;[root@zjzc01 binlog]# cat binlog.pl 
    if ( $#ARGV < 2 ){  
            print "please input file  update|insert table_namee!
    ";  
            exit(-1);  
    
                   }; 
    my $a=$ARGV[0];
    my $b=$ARGV[1];
    my $c=$ARGV[2];
    local $/='/*!*/;';
    open (A,"<","$a");
         while (<A>){
          if  (( $_ =~/$bs+$c/i ) or ($_ =~/$bs+`$c`/i) or ($_ =~/$bs+`zjzc`.`$c`/i) ){
          print $_;
            };
          };
     
    [root@zjzc01 binlog]# perl binlog.pl aa UPDATE scan
    
    UPDATE `zjzc`.`scan` SET `sn`='200' WHERE `sn`='100'
    
    
    [root@zjzc01 binlog]# perl binlog.pl aa UPDATE scan
    
    UPDATE `zjzc`.`scan` SET `sn`='200' WHERE `sn`='100'
    /*!*/;
    UPDATE `scan` SET `sn`='300' WHERE `sn`='200'
    
    
    
    [root@zjzc01 binlog]# perl binlog.pl aa UPDATE scan
    
    UPDATE `zjzc`.`scan` SET `sn`='200' WHERE `sn`='100'
    /*!*/;
    UPDATE `scan` SET `sn`='300' WHERE `sn`='200'
    /*!*/;
    UPDATE scan SET `sn`='400' WHERE `sn`='300'
    
    /*!*/;[root@zjzc01 binlog]# cat binlog.pl 
    if ( $#ARGV < 2 ){  
            print "please input file  update|insert table_namee!
    ";  
            exit(-1);  
    
                   }; 
    my $a=$ARGV[0];
    my $b=$ARGV[1];
    my $c=$ARGV[2];
    local $/='/*!*/;';
    open (A,"<","$a");
         while (<A>){
          if  (( $_ =~/$bs+$c/i ) or ($_ =~/$bs+`$c`/i) or ($_ =~/$bs+`zjzc`.`$c`/i) or ($_ =~/$bs+zjzc.$c/i )){
          print $_;
            };
          };
     
    [root@zjzc01 binlog]# perl binlog.pl aa UPDATE scan
    
    UPDATE `zjzc`.`scan` SET `sn`='200' WHERE `sn`='100'
    /*!*/;
    UPDATE `scan` SET `sn`='300' WHERE `sn`='200'
    /*!*/;
    UPDATE scan SET `sn`='400' WHERE `sn`='300'
    /*!*/;
    UPDATE zjzc.scan SET `sn`='500' WHERE `sn`='400'
    
    /*!*/;[root@zjzc01 binlog]# cat binlog.pl 
    if ( $#ARGV < 2 ){  
            print "please input file  update|insert table_namee!
    ";  
            exit(-1);  
    
                   }; 
    my $a=$ARGV[0];
    my $b=$ARGV[1];
    my $c=$ARGV[2];
    local $/='/*!*/;';
    open (A,"<","$a");
         while (<A>){
          if  (( $_ =~/$bs+$c/i ) or ($_ =~/$bs+`$c`/i) or ($_ =~/$bs+`zjzc`.`$c`/i) or ($_ =~/$bs+zjzc.$c/i )){
          print $_;
            };
          };

  • 相关阅读:
    KubeSphere 社区开源负载均衡器 Porter 进入 CNCF 云原生全景图
    The Overview of KubeSphere 3.0
    对象存储在无人驾驶高精度地图的场景实践
    谁来打通混合云“最后一公里”?唯有容器混合云
    QingStor 对象存储架构设计及最佳实践
    如何通过IAM打造零信任安全架构
    智能家居巨头 Aqara 基于 KubeSphere 打造物联网微服务平台
    微信小程序集成jenkins自动打码
    windows运行python,提示import win32file ImportError: DLL load failed: 找不到指定的程序。
    centos7搭建easy-mock服务
  • 原文地址:https://www.cnblogs.com/hzcya1995/p/13350177.html
Copyright © 2011-2022 走看看