maxwell简单部署使用

详细资料可以参考maxwell官网  (mysql + maxwell + kafka + elasticsearch)
说明:本文主要是关于配置maxwell监听mysql的数据修改并实时将修改内容同步到kafka中。

- 配置mysql启用binlog

配置/etc/my.cnf,然后重启mysql服务

[mysqld]
server-id=1
log-bin=master
binlog_format=row

在mysql中给maxwell授予相应的权限并建立maxwell数据库

MariaDB [(none)]>  GRANT ALL on maxwell.* to 'maxwell'@'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]>  GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE on *.* to 'maxwell'@'%'; Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.00 sec) 

建立一个测试用表,并插入一条数据

MariaDB [(none)]> use hivetest;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A Database changed MariaDB [hivetest]> insert into test set name = '11111', age = '12313'; Query OK, 1 row affected (0.00 sec) 

- maxwell配置文件

[root@datanode1 ~]# cat /opt/maxwell-1.10.6/config.properties  | grep -v ^#  | grep -v ^$
log_level=info
producer=kafka
kafka.bootstrap.servers=192.168.190.11:9092,192.168.190.14:9092,192.168.190.17:9092
host=localhost
user=maxwell
password=123456
kafka_topic=test
kafka.compression.type=snappy
kafka.metadata.fetch.timeout.ms=5000
kafka.retries=3
kafka.acks=all
kinesis_stream=maxwell

启动maxwell测试下是否能正常获取binglog

[root@datanode1 maxwell-1.10.6]# bin/maxwell --user='maxwell' --password='123456' --host='127.0.0.1' --producer=stdout
14:12:01,700 WARN MaxwellMetrics - Metrics will not be exposed: metricsReportingType not configured. 14:12:01,933 INFO SchemaStoreSchema - Creating maxwell database 14:12:02,004 INFO Maxwell - Maxwell v1.10.6 is booting (StdoutProducer), starting at Position[BinlogPosition[mysql-bin.000001:3997], lastHeartbeat=0] 14:12:02,146 INFO AbstractSchemaStore - Maxwell is capturing initial schema 14:12:02,328 INFO BinlogConnectorReplicator - Setting initial binlog pos to: mysql-bin.000001:3997 14:12:02,383 INFO BinaryLogClient - Connected to 127.0.0.1:3306 at mysql-bin.000001/3997 (sid:6379, cid:7) {"database":"hivetest","table":"test","type":"insert","ts":1506319983,"xid":142,"commit":true,"data":{"id":168,"name":"11111","age":12313,"create_time":"2017-09-25 06:13:03"}} 

ok,测试成功。
后台启动maxwell,并将数据发送到kafka(需要先在kafka中建好topic)

[root@datanode1 ~]# nohup bin/maxwell --user='maxwell' --password='123456' --host='127.0.0


作者:观天坏笑
链接:https://www.jianshu.com/p/5621e801f142
來源:简书
简书著作权归作者所有,任何形式的转载都请联系作者获得授权并注明出处。

转载于:https://www.cnblogs.com/andydao/p/9712851.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值