通过麦克斯韦实时增量抽取MySQL binlog并通过stdout展示

  

下载麦克斯韦

  

解压麦克斯韦

  

修改MySQL的配置文

件my . cnf中所做   
 <代码> [root@hadoop000等]。# vi my . cnf中所做
  
  (mysqld)
  服务器id=1
  binlog_format=行 
  

<强> binlog_format必须设为连续模式,如果设为其他模式,比如binlog_format=声明,启动麦克斯韦时会报错

  
 <代码> [root@hadoop001 maxwell-1.17.1] # bin/麦克斯韦——用户=奥罂怂刮ざ薄苈?奥罂怂刮ざ薄骰??27.0.0.1”——生产商=stdout
  使用卡夫卡版本:1.0.0
  08:57:08,194警告MaxwellMetrics -指标不会暴露:metricsReportingType不配置。
  08:57:08,521信息TaskManager -停止0任务
  08:57:08,521错误TaskManager——原因:
  com.zendesk.maxwell。binlog_format MaxwellCompatibilityError:变量必须设置为“行”
  com.zendesk.maxwell.MaxwellMysqlStatus.ensureVariableState (MaxwellMysqlStatus.java: 42) ~ (maxwell-1.17.1.jar 1.17.1):
  在com.zendesk.maxwell.MaxwellMysqlStatus.ensureReplicationMysqlState (MaxwellMysqlStatus.java: 70) ~ (maxwell-1.17.1.jar 1.17.1):
  在com.zendesk.maxwell.Maxwell.startInner (Maxwell.java: 173) ~ (maxwell-1.17.1.jar 1.17.1):
  在com.zendesk.maxwell.Maxwell.start (Maxwell.java: 156) ~ (maxwell-1.17.1.jar 1.17.1):
  在com.zendesk.maxwell.Maxwell.main (Maxwell.java: 245) ~ (maxwell-1.17.1.jar 1.17.1):
  08:57:08,525信息TaskManager——停止所有的任务
  com.zendesk.maxwell。binlog_format MaxwellCompatibilityError:变量必须设置为“行”
  在com.zendesk.maxwell.MaxwellMysqlStatus.ensureVariableState (MaxwellMysqlStatus.java: 42)
  com.zendesk.maxwell.MaxwellMysqlStatus.ensureReplicationMysqlState (MaxwellMysqlStatus.java: 70)
  com.zendesk.maxwell.Maxwell.startInner (Maxwell.java: 173)
  com.zendesk.maxwell.Maxwell.start (Maxwell.java: 156)
  com.zendesk.maxwell.Maxwell.main (Maxwell.java: 245)  
  

启动MySQL

  
 <代码> [mysqladmin@hadoop000 ~]服务mysql美元开始
  启动MySQL ....(好的)
  [mysqladmin@hadoop000 ~]美元mysql -uroot - p
  输入密码:
  欢迎来到MySQL监视器。命令结尾;或\ g。
  你的MySQL连接id是1
  服务器版本:5.6.23-log MySQL社区服务器(GPL)
  
  版权(c) 2000、2015、Oracle和/或其附属公司。保留所有权利。
  
  甲骨文是甲骨文公司的注册商标和/或其
  子公司。其他名称可能是各自的商标
  的主人。
  
  类型的帮助,“或“\ h”寻求帮助。类型“\ c”明确当前输入语句。
  
  mysql>显示变量如“% binlog %”;
  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - +
  | | Variable_name |值
  + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - - - +
  | binlog_cache_size | 32768 |
  | binlog_checksum | CRC32 |
  | binlog_direct_non_transactional_updates | |
  | binlog_error_action | IGNORE_ERROR |
  | | binlog_format |行//binlog_format已生效
  | binlog_gtid_simple_recovery | |
  | binlog_max_flush_queue_time | 0 |
  | binlog_order_commits |——停止位置=" 4158 "/usr/local/mysql/arch/mysql-bin.000016/* !50530集@@SESSION.PSEUDO_SLAVE_MODE=1 */;/* !40019集@@session.max_insert_delayed_threads=0 */;/* !50003集@OLD_COMPLETION_TYPE=@@COMPLETION_TYPE COMPLETION_TYPE=0 */;
  分隔符/* ! */;
  # 3954
  # 190309 8:21:44服务器id 4025 end_log_pos CRC32 0 xf962b4b1 Table_map:“hlwtest”。“emp”映射到71号
  # 4025
  # 190309 8:21:44服务器id 4127 end_log_pos CRC32 0 x5013e9f3 Update_rows:表id 71旗帜:STMT_END_F
  
  BINLOG”
  GAeDXBMBAAAARwAAALkPAAAAAEcAAAAAAAEAB2hsd3Rlc3QAA2VtcAAI9g8P9hL29vYPBAAKAAkA
  BAAABwIHAgIA/rG0Yvk=GAeDXB8BAAAAZgAAAB8QAAAAAEcAAAAAAAEAAgAI//8 al3eeu0lxqqhervnjr05fuptzmakqaaca
  + gAgBdwAKgAl3EEU0lXQQhERVNJR05FUptZmaKQAACAAfQAgBdwAKjz6RNQ/* ! */;
  # 4127
  # 190309 8:21:44服务器id 4158 end_log_pos CRC32 0 xfc03c0c3 Xid=138
  提交/* ! */;
  分隔符;
  #日志文件的结束
  回滚mysqlbinlog *//*添加;/* !50003集COMPLETION_TYPE=@OLD_COMPLETION_TYPE */;/* !50530集@@SESSION.PSEUDO_SLAVE_MODE=0 */;  
  
      <李>加上参数(-base64-output=decode-rows - v)对输出结果解码李   
  
 <代码类=" language-shell "> [mysqladmin@hadoop001本]美元mysqlbinlog——base64-output=decode-rows - v——起始位置=" 3954 "停止位置=" 4158 "/usr/local/mysql/arch/mysql-bin.000016/* !50530集@@SESSION.PSEUDO_SLAVE_MODE=1 */;/* !40019集@@session.max_insert_delayed_threads=0 */;/* !50003集@OLD_COMPLETION_TYPE=@@COMPLETION_TYPE COMPLETION_TYPE=0 */;
  分隔符/* ! */;
  # 3954
  # 190309 8:21:44服务器id 4025 end_log_pos CRC32 0 xf962b4b1 Table_map:“hlwtest”。“emp”映射到71号
  # 4025
  # 190309 8:21:44服务器id 4127 end_log_pos CRC32 0 x5013e9f3 Update_rows:表id 71旗帜:STMT_END_F
  # # #更新“hlwtest”。“emp”
  # # #,
  # # # @1=6001
  # # # @2='锡瓦的
  # # # @3=吧杓剖Α?
  # # # @4=7001
  # # # @5=' 2019-03-08就是'
  # # # @6=1000.00
  # # # @7=6000.00
  # # # @8=40
  # # #设置
  # # # @1=6001
  # # # @2='锡瓦的
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null
  null

通过麦克斯韦实时增量抽取MySQL binlog并通过stdout展示