美文网首页
Maxwell on docker

Maxwell on docker

作者: 望山不是山 | 来源:发表于2021-06-29 14:33 被阅读0次
  • Install mysql
  1. Install mysql5.7
docker network create db_network
docker run -d \
--name mysql57 \
--publish 3306 \
--network db_network \
--restart unless-stopped \
--env MYSQL_ROOT_PASSWORD=mypassword \
mysql:5.7
  1. Modify mysql conf
$ docker exec -it mysql57 /bin/bash
$ apt-get update
$ apt-get install vim
$ vi /etc/mysql/my.cnf
[mysqld]
server_id=1
log-bin=master
binlog_format=row
  1. Restart mysql on docker
$ docker restart mysql57
  1. Config mysql
mysql> CREATE USER 'maxwell'@'%' IDENTIFIED BY 'XXXXXX';
mysql> GRANT ALL ON maxwell.* TO 'maxwell'@'%';
mysql> GRANT SELECT, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO 'maxwell'@'%';
  • Install maxwell
  1. Download maxwell of docker
$ docker pull zendesk/maxwell
  1. Start maxwell
    2.1 print to consol
docker run --network db_network -it --rm zendesk/maxwell bin/maxwell --user='maxwell' \
    --password='XXXXXX' --host='mysql57' --producer=stdout

2.2 send to kafka

docker run --network db_network --name maxwell_kafka -d zendesk/maxwell bin/maxwell --user='maxwell' \
    --password='XXXXXX' --host='mysql57' --producer=kafka \
    --kafka.bootstrap.servers=kafka:9092 --kafka_topic=binlog_test

link:

  1. http://maxwells-daemon.io/quickstart/

相关文章

网友评论

      本文标题:Maxwell on docker

      本文链接:https://www.haomeiwen.com/subject/rotkultx.html