maxwell的简单安装及使用

  1. 下载安装包
http://maxwells-daemon.io/
# 解压
tar -zxvf maxwell-1.23.3.tar.gz -C /app/
  1. mysql 配置
$ vi /etc/my.cnf

[mysqld]
server_id=1
log-bin=master
binlog_format=row

3.创建maxwell 数据库 及用户

create database maxwell;
mysql> CREATE USER 'maxwell'@'%' IDENTIFIED BY '123456';
mysql> GRANT ALL ON maxwell.* TO 'maxwell'@'%';
mysql> GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'maxwell'@'%';
 FLUSH PRIVILEGES;

4.运行 maxwell

#stdout
bin/maxwell --user='maxwell' --password='123456' --host='hadoop001' --producer=stdout
#kafka
bin/maxwell --user='maxwell' --password='123456' --host='hadoop001' \
--producer=kafka --kafka.bootstrap.servers=hadoop001:9092 \
--kafka_topic=maxwell 

#producer 
    stdout 控制台输出
    kafka  卡夫卡输出
--daemon  守护进程 后台运行
--filter  过滤条件,可以过滤数据库,表,列等等
  1. 测试
# mysql 新增信息
mysql> insert into user_domain values('1','baidu.com');
Query OK, 1 row affected (0.00 sec)

[hadoop@hadoop001 maxwell]$ bin/maxwell --user='maxwell' --password='123456' --host='hadoop001' --producer=stdout
# 注意 如使用kafka,则版本要与你的kafka版本一致
通过 --kafka_version 指定
Using kafka version: 1.0.0
09:14:11,770 WARN  MaxwellMetrics - Metrics will not be exposed: metricsReportingType not configured.
09:14:12,001 INFO  Maxwell - Maxwell v1.23.3 is booting (StdoutProducer), starting at Position[BinlogPosition[master.000001:4393], lastHeartbeat=0]
09:14:12,093 INFO  MysqlSavedSchema - Restoring schema id 1 (last modified at Position[BinlogPosition[master.000001:4393], lastHeartbeat=0])
09:14:12,162 INFO  BinlogConnectorReplicator - Setting initial binlog pos to: master.000001:4393
09:14:12,251 INFO  BinaryLogClient - Connected to hadoop001:3306 at master.000001/4393 (sid:6379, cid:6)
09:14:12,251 INFO  BinlogConnectorLifecycleListener - Binlog connected.

{"database":"sparkdb","table":"user_domain","type":"insert","ts":1574903833,"xid":310,"commit":true,"data":{"user_id":"1","domain":"baidu.com"}}
{"database":"sparkdb","table":"user_domain","type":"update","ts":1574903966,"xid":488,"commit":true,"data":{"user_id":"1","domain":"taobao.com"},"old":{"domain":"baidu.com"}}


  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值