http://maxwells-daemon.io/quickstart/
Download
- Download binary distro: https://github.com/zendesk/maxwell/releases/download/v1.33.0/maxwell-1.33.0.tar.gz
- Sources and bug tracking is available on github: https://github.com/zendesk/maxwell
curl:
curl -sLo - https://github.com/zendesk/maxwell/releases/download/v1.33.0/maxwell-1.33.0.tar.gz \ | tar zxvf - cd maxwell-1.33.0
docker:
docker pull zendesk/maxwell
homebrew:
brew install maxwell
Configure Mysql
Server Config: Ensure server_id is set, and that row-based replication is on.
$ vi my.cnf [mysqld] server_id=1 log-bin=master binlog_format=row
Or on a running server:
mysql> set global binlog_format=ROW; mysql> set global binlog_row_image=FULL;
note: binlog_format
is a session-based property. You will need to shutdown all active connections to fully convert to row-based replication.
Permissions: Maxwell needs permissions to act as a replica, and to write to the maxwell
database.
mysql> CREATE USER 'maxwell'@'%' IDENTIFIED BY 'XXXXXX'; mysql> GRANT ALL ON maxwell.* TO 'maxwell'@'%'; mysql> GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'maxwell'@'%';
# or for running maxwell locally:
mysql> CREATE USER 'maxwell'@'localhost' IDENTIFIED BY 'XXXXXX'; mysql> GRANT ALL ON maxwell.* TO 'maxwell'@'localhost'; mysql> GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'maxwell'@'localhost';
Run Maxwell
Command line
bin/maxwell --user='maxwell' --password='XXXXXX' --host='127.0.0.1' --producer=stdout
Docker
docker run -it --rm zendesk/maxwell bin/maxwell --user=$MYSQL_USERNAME \
--password=$MYSQL_PASSWORD --host=$MYSQL_HOST --producer=stdout
Kafka
Boot kafka as described here: http://kafka.apache.org/documentation.html#quickstart, then:
bin/maxwell --user='maxwell' --password='XXXXXX' --host='127.0.0.1' \ --producer=kafka --kafka.bootstrap.servers=localhost:9092 --kafka_topic=maxwell
(or docker):
docker run -it --rm zendesk/maxwell bin/maxwell --user=$MYSQL_USERNAME \ --password=$MYSQL_PASSWORD --host=$MYSQL_HOST --producer=kafka \ --kafka.bootstrap.servers=$KAFKA_HOST:$KAFKA_PORT --kafka_topic=maxwell
Kinesis
docker run -it --rm --name maxwell -v `cd && pwd`/.aws:/root/.aws zendesk/maxwell sh -c 'cp /app/kinesis-producer-library.properties.example \
/app/kinesis-producer-library.properties && echo "Region=$AWS_DEFAULT_REGION" >> /app/kinesis-producer-library.properties && bin/maxwell \
--user=$MYSQL_USERNAME \
--password=$MYSQL_PASSWORD --host=$MYSQL_HOST \
--producer=kinesis --kinesis_stream=$KINESIS_STREAM' \
Nats
bin/maxwell --user='maxwell' --password='XXXXXX' --host='127.0.0.1' \ --producer=nats --nats_url=='0.0.0.0:4222'
Google Cloud Pub/Sub
bin/maxwell --user='maxwell' --password='XXXXXX' --host='127.0.0.1' \ --producer=pubsub --pubsub_project_id='$PUBSUB_PROJECT_ID' \ --pubsub_topic='maxwell'
RabbitMQ
1 2 | bin/maxwell --user= 'maxwell' --password= 'XXXXXX' --host= '127.0.0.1' \ --producer=rabbitmq --rabbitmq_host= 'rabbitmq.hostname' |
Redis
bin/maxwell --user='maxwell' --password='XXXXXX' --host='127.0.0.1' \ --producer=redis --redis_host=redis.hostname
SNS
bin/maxwell --user='maxwell' --password='XXXXXX' --host='127.0.0.1' \ --producer=sns --sns_topic=sns.topic --sns_attrs=database,table
启动:
./bin/maxwell --user='root' --password='6677mCom' --host='127.0.0.1' --producer=rabbitmq --rabbitmq_host='192.168.2.232' --rabbitmq_port='5672' \
--rabbitmq_routing_key_template="maxwell.%table%" --rabbitmq_exchange='maxwell' --rabbitmq_exchange_type='direct'
创建队列 并绑定路由
{"database":"liexin_crm","table":"lie_invoice_company","type":"update","ts":1618917918,"xid":46607,"commit":true,"data":{"id":28,"company_type":0,"com_sn":"810980","erp_com_sn":"","user_id":1600,"tax_id":0,"com_name":"白云公司123456","com_addr":"ggg","com_tel":"hhh","com_tax_registration":"咕咕咕咕咕咕tt","com_bank":"订单的忍忍tttrrr","com_bank_num":"","com_nature":0,"establishment_time":0,"registered_capital":0.0000,"com_organization":"","legal_representative":"","five_legal_change":0,"two_years_no_lawsuit":"","total_credit_score":0.00,"ichunt_hunting_core":0,"blacklist_hit":"","risk_type":0,"is_kefu_certified":1,"customer_en":"","customer_type":0,"product_use_classone_sn":-1,"product_use_classtwo_sn":-1,"customer_website":"","customer_desc":"","business_license_src":"","sale_department":0,"status":1,"create_time":1601016871,"update_time":1615952875},"old":{"com_addr":"","com_tel":"","com_tax_registration":"咕咕咕咕咕咕"}}
本文来自博客园,作者:孙龙-程序员,转载请注明原文链接:https://www.cnblogs.com/sunlong88/p/14682517.html
分类:
golang
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· C#/.NET/.NET Core优秀项目和框架2025年2月简报
· DeepSeek在M芯片Mac上本地化部署
· 葡萄城 AI 搜索升级:DeepSeek 加持,客户体验更智能
2020-04-20 MySQL时间戳和时间的获取/相互转换/格式化
2020-04-20 golang sql连接池的实现解析
2019-04-20 python高级编程