华强北手机网站建设,wordpress访问许可,百度竞价登陆,茶网站建设需要多少钱文章目录 1、maxwell 输出消息到 redis1.1、启动一个Maxwell容器#xff0c;它会连接到指定的MySQL数据库#xff0c;捕获变更事件#xff0c;并将这些事件以Redis发布/订阅的形式发送到指定的Redis服务器1.2、在已运行的 Redis 容器中执行 Redis 命令行界面#xff08;CLI… 文章目录 1、maxwell 输出消息到 redis1.1、启动一个Maxwell容器它会连接到指定的MySQL数据库捕获变更事件并将这些事件以Redis发布/订阅的形式发送到指定的Redis服务器1.2、在已运行的 Redis 容器中执行 Redis 命令行界面CLI工具解决方法示例完整命令示例注意事项 1.3、tingshu_album 数据库中 新增数据1.4、tingshu_album 数据库中 更新数据1.5、tingshu_album 数据库中 删除数据1.6、总结  1、maxwell 输出消息到 redis Reference - Maxwell’s Daemonhttps://maxwells-daemon.io/config/ redis-producerhttps://maxwells-daemon.io/config/#redis-producer  
1.1、启动一个Maxwell容器它会连接到指定的MySQL数据库捕获变更事件并将这些事件以Redis发布/订阅的形式发送到指定的Redis服务器 
docker run -it --rm zendesk/maxwell bin/maxwell --user$MYSQL_USERNAME \--password$MYSQL_PASSWORD --host$MYSQL_HOST --producerstdoutdocker run -it --rm zendesk/maxwell bin/maxwell --usermaxwell \--passwordmaxwell --host192.168.74.148 --port3306 --producerredis \--redis_host192.168.74.148 --redis_port6379 --redis_auth123456 --redis_typepubsub --redis_keymaxwell您提供的命令是一个Docker命令用于运行Zendesk Maxwell这个容器化应用程序。Maxwell是一个变更数据捕获CDC工具用于从MySQL数据库捕获变更事件并将它们发布到其他系统如Redis、Kafka等。下面是对该命令的详细解释 
docker run -it --rm zendesk/maxwell bin/maxwell \--usermaxwell \--passwordmaxwell \--host192.168.74.148 \--port3306 \--producerredis \--redis_host192.168.74.148 \--redis_port6379 \--redis_auth123456 \--redis_typepubsub \--redis_keymaxwelldocker run: 这是Docker用来创建和启动一个新的容器实例的命令。-it: 这两个选项告诉Docker在前台运行容器并且保持交互模式打开使得可以在容器内部执行命令。–rm: 这个选项指示Docker在容器退出后自动删除容器有助于保持系统清洁。zendesk/maxwell: 这是指定要运行的Docker镜像的名称即Zendesk提供的Maxwell镜像。bin/maxwell: 这是Maxwell可执行文件的路径告诉Docker运行这个特定的二进制文件。–usermaxwell: 指定连接到MySQL数据库的用户名。–passwordmaxwell: 指定连接到MySQL数据库的密码。–host192.168.74.148: 指定MySQL数据库服务器的IP地址。–port3306: 指定MySQL数据库服务器的端口号。–producerredis: 指定Maxwell应该将变更事件发布到Redis。–redishost192.168.74.148: 指定Redis服务器的IP地址。–redisport6379: 指定Redis服务器的端口号。–redisauth123456: 指定连接到Redis服务器的认证密码。–redistypepubsub: 指定Redis的发布/订阅模式作为消息传递机制。Publish/Subscribe即发布/订阅模式。–rediskeymaxwell: 指定在Redis中使用的键名Maxwell将变更事件发布到这个键对应的频道。 执行这个命令会启动一个Maxwell容器它会连接到指定的MySQL数据库捕获变更事件并将这些事件以Redis发布/订阅的形式发送到指定的Redis服务器。 
[rootlocalhost ~]# docker run -it --rm zendesk/maxwell bin/maxwell \--usermaxwell \--passwordmaxwell \--host192.168.74.148 \--port3306 \--producerredis \--redis_host192.168.74.148 \--redis_port6379 \--redis_auth123456 \--redis_typepubsub \--redis_keymaxwell
2024-09-19 10:13:40 INFO  Maxwell - Starting Maxwell. maxMemory: 1031798784 bufferMemoryUsage: 0.25
2024-09-19 10:13:40 INFO  Maxwell - Maxwell v1.41.2 is booting (MaxwellRedisProducer), starting at Position[BinlogPosition[spzxbinlog.000003:6061], lastHeartbeat0]
2024-09-19 10:13:40 INFO  MysqlSavedSchema - Restoring schema id 1 (last modified at Position[BinlogPosition[spzxbinlog.000003:156], lastHeartbeat0])
2024-09-19 10:13:41 INFO  BinlogConnectorReplicator - Setting initial binlog pos to: spzxbinlog.000003:6061
2024-09-19 10:13:41 INFO  BinaryLogClient - Connected to 192.168.74.148:3306 at spzxbinlog.000003/6061 (sid:6379, cid:43)
2024-09-19 10:13:41 INFO  BinlogConnectorReplicator - Binlog connected.1.2、在已运行的 Redis 容器中执行 Redis 命令行界面CLI工具 
[rootlocalhost ~]# docker exec -it spzx-redis redis-cli
127.0.0.1:6379 [rootlocalhost ~]# docker exec -it spzx-redis redis-cli
127.0.0.1:6379 SUBSCRIBE maxwell
Reading messages... (press Ctrl-C to quit)
(error) NOAUTH Authentication required.当你尝试在 Redis 容器中使用 SUBSCRIBE 命令时收到 (error) NOAUTH Authentication required. 错误这意味着 Redis 服务器需要认证才能执行命令。Redis 从版本 3.0 开始支持密码认证功能。 
解决方法 
要在 Redis 中执行需要认证的操作你需要先使用 AUTH 命令提供正确的密码。以下是具体的步骤 连接到 Redis: 使用 docker exec -it spzx-redis redis-cli 连接到 Redis CLI。  提供认证: 使用 AUTH 命令提供 Redis 服务器所需的密码。假设密码是 yourpassword命令如下 AUTH yourpassword执行订阅操作: 成功认证后你可以继续执行订阅命令 SUBSCRIBE maxwell示例 
假设 Redis 的密码是 maxwell你可以按照以下步骤操作 连接到 Redis CLI docker exec -it spzx-redis redis-cli提供认证 AUTH maxwell执行订阅操作 SUBSCRIBE maxwell完整命令示例 
你可以在一次命令中完成认证和订阅 
docker exec -it spzx-redis redis-cli -n 0  EOF
AUTH maxwell
SUBSCRIBE maxwell
EOF或者你也可以在 Redis CLI 中逐条输入命令 
docker exec -it spzx-redis redis-cli
127.0.0.1:6379 AUTH maxwell
127.0.0.1:6379 SUBSCRIBE maxwell注意事项 密码安全: 确保使用强密码并且不要在命令行中明文显示密码。可以考虑使用环境变量或其他方式传递密码。  Redis 配置文件: 确保 Redis 的配置文件redis.conf中设置了 requirepass 选项并指定了正确的密码。  
通过上述步骤你应该能够成功地通过认证并执行 Redis 的订阅命令。如果仍然遇到问题请检查 Redis 的配置和密码是否正确。 
[rootlocalhost ~]# docker exec -it spzx-redis redis-cli
127.0.0.1:6379 SUBSCRIBE maxwell
Reading messages... (press Ctrl-C to quit)
(error) NOAUTH Authentication required.
127.0.0.1:6379 auth 123456
OK
127.0.0.1:6379 SUBSCRIBE maxwell
Reading messages... (press Ctrl-C to quit)
1) subscribe
2) maxwell
3) (integer) 11.3、tingshu_album 数据库中 新增数据 [rootlocalhost ~]# docker exec -it spzx-redis redis-cli
127.0.0.1:6379 SUBSCRIBE maxwell
Reading messages... (press Ctrl-C to quit)
(error) NOAUTH Authentication required.
127.0.0.1:6379 auth 123456
OK
127.0.0.1:6379 SUBSCRIBE maxwell
Reading messages... (press Ctrl-C to quit)
1) subscribe
2) maxwell
3) (integer) 1
1) message
2) maxwell
3) {\database\:\tingshu_album\,\table\:\base_category1\,\type\:\insert\,\ts\:1726741946,\xid\:6478,\commit\:true,\data\:{\id\:16,\name\:\maxwell\,\order_num\:0,\create_time\:\2024-09-19 10:32:26\,\update_time\:\2024-09-19 10:32:26\,\is_deleted\:0}}1.4、tingshu_album 数据库中 更新数据 [rootlocalhost ~]# docker exec -it spzx-redis redis-cli
127.0.0.1:6379 SUBSCRIBE maxwell
Reading messages... (press Ctrl-C to quit)
(error) NOAUTH Authentication required.
127.0.0.1:6379 auth 123456
OK
127.0.0.1:6379 SUBSCRIBE maxwell
Reading messages... (press Ctrl-C to quit)
1) subscribe
2) maxwell
3) (integer) 1
1) message
2) maxwell
3) {\database\:\tingshu_album\,\table\:\base_category1\,\type\:\insert\,\ts\:1726741946,\xid\:6478,\commit\:true,\data\:{\id\:16,\name\:\maxwell\,\order_num\:0,\create_time\:\2024-09-19 10:32:26\,\update_time\:\2024-09-19 10:32:26\,\is_deleted\:0}}
1) message
2) maxwell
3) {\database\:\tingshu_album\,\table\:\base_category1\,\type\:\update\,\ts\:1726742253,\xid\:7197,\commit\:true,\data\:{\id\:16,\name\:\plus\,\order_num\:0,\create_time\:\2024-09-19 10:32:26\,\update_time\:\2024-09-19 10:37:33\,\is_deleted\:0},\old\:{\name\:\maxwell\,\update_time\:\2024-09-19 10:32:26\}}1.5、tingshu_album 数据库中 删除数据 [rootlocalhost ~]# docker exec -it spzx-redis redis-cli
127.0.0.1:6379 SUBSCRIBE maxwell
Reading messages... (press Ctrl-C to quit)
(error) NOAUTH Authentication required.
127.0.0.1:6379 auth 123456
OK
127.0.0.1:6379 SUBSCRIBE maxwell
Reading messages... (press Ctrl-C to quit)
1) subscribe
2) maxwell
3) (integer) 1
1) message
2) maxwell
3) {\database\:\tingshu_album\,\table\:\base_category1\,\type\:\insert\,\ts\:1726741946,\xid\:6478,\commit\:true,\data\:{\id\:16,\name\:\maxwell\,\order_num\:0,\create_time\:\2024-09-19 10:32:26\,\update_time\:\2024-09-19 10:32:26\,\is_deleted\:0}}
1) message
2) maxwell
3) {\database\:\tingshu_album\,\table\:\base_category1\,\type\:\update\,\ts\:1726742253,\xid\:7197,\commit\:true,\data\:{\id\:16,\name\:\plus\,\order_num\:0,\create_time\:\2024-09-19 10:32:26\,\update_time\:\2024-09-19 10:37:33\,\is_deleted\:0},\old\:{\name\:\maxwell\,\update_time\:\2024-09-19 10:32:26\}}
1) message
2) maxwell
3) {\database\:\tingshu_album\,\table\:\base_category1\,\type\:\delete\,\ts\:1726742435,\xid\:7622,\commit\:true,\data\:{\id\:16,\name\:\plus\,\order_num\:0,\create_time\:\2024-09-19 10:32:26\,\update_time\:\2024-09-19 10:37:33\,\is_deleted\:0}}1.6、总结 
 文章转载自: http://www.morning.ghwdm.cn.gov.cn.ghwdm.cn http://www.morning.rtryr.cn.gov.cn.rtryr.cn http://www.morning.ldqrd.cn.gov.cn.ldqrd.cn http://www.morning.tymnr.cn.gov.cn.tymnr.cn http://www.morning.qbgdy.cn.gov.cn.qbgdy.cn http://www.morning.hrrmb.cn.gov.cn.hrrmb.cn http://www.morning.gbnsq.cn.gov.cn.gbnsq.cn http://www.morning.smdnl.cn.gov.cn.smdnl.cn http://www.morning.bgrsr.cn.gov.cn.bgrsr.cn http://www.morning.swsrb.cn.gov.cn.swsrb.cn http://www.morning.bpmtx.cn.gov.cn.bpmtx.cn http://www.morning.gpmrj.cn.gov.cn.gpmrj.cn http://www.morning.qzglh.cn.gov.cn.qzglh.cn http://www.morning.ckhry.cn.gov.cn.ckhry.cn http://www.morning.drqrl.cn.gov.cn.drqrl.cn http://www.morning.jsxrm.cn.gov.cn.jsxrm.cn http://www.morning.mxcgf.cn.gov.cn.mxcgf.cn http://www.morning.vvbsxm.cn.gov.cn.vvbsxm.cn http://www.morning.mnslh.cn.gov.cn.mnslh.cn http://www.morning.zdmlt.cn.gov.cn.zdmlt.cn http://www.morning.hnkkm.cn.gov.cn.hnkkm.cn http://www.morning.kmqlf.cn.gov.cn.kmqlf.cn http://www.morning.hjbrd.cn.gov.cn.hjbrd.cn http://www.morning.spghj.cn.gov.cn.spghj.cn http://www.morning.bftr.cn.gov.cn.bftr.cn http://www.morning.gklxm.cn.gov.cn.gklxm.cn http://www.morning.wjlnz.cn.gov.cn.wjlnz.cn http://www.morning.lmdkn.cn.gov.cn.lmdkn.cn http://www.morning.cjxqx.cn.gov.cn.cjxqx.cn http://www.morning.wcyr.cn.gov.cn.wcyr.cn http://www.morning.nchlk.cn.gov.cn.nchlk.cn http://www.morning.yrflh.cn.gov.cn.yrflh.cn http://www.morning.bwgrd.cn.gov.cn.bwgrd.cn http://www.morning.prhqn.cn.gov.cn.prhqn.cn http://www.morning.llthz.cn.gov.cn.llthz.cn http://www.morning.nlgnk.cn.gov.cn.nlgnk.cn http://www.morning.demoux.com.gov.cn.demoux.com http://www.morning.yxdrf.cn.gov.cn.yxdrf.cn http://www.morning.tmfm.cn.gov.cn.tmfm.cn http://www.morning.pluimers.cn.gov.cn.pluimers.cn http://www.morning.mdtfh.cn.gov.cn.mdtfh.cn http://www.morning.mkygc.cn.gov.cn.mkygc.cn http://www.morning.kzcz.cn.gov.cn.kzcz.cn http://www.morning.qydgk.cn.gov.cn.qydgk.cn http://www.morning.kxltf.cn.gov.cn.kxltf.cn http://www.morning.gqflj.cn.gov.cn.gqflj.cn http://www.morning.btcgq.cn.gov.cn.btcgq.cn http://www.morning.lfxcj.cn.gov.cn.lfxcj.cn http://www.morning.tgwfn.cn.gov.cn.tgwfn.cn http://www.morning.lgxzj.cn.gov.cn.lgxzj.cn http://www.morning.nccyc.cn.gov.cn.nccyc.cn http://www.morning.qkrz.cn.gov.cn.qkrz.cn http://www.morning.dwfxl.cn.gov.cn.dwfxl.cn http://www.morning.snrhg.cn.gov.cn.snrhg.cn http://www.morning.hknk.cn.gov.cn.hknk.cn http://www.morning.dljujia.com.gov.cn.dljujia.com http://www.morning.zwtp.cn.gov.cn.zwtp.cn http://www.morning.qqrqb.cn.gov.cn.qqrqb.cn http://www.morning.hmmtx.cn.gov.cn.hmmtx.cn http://www.morning.pxrfm.cn.gov.cn.pxrfm.cn http://www.morning.hlmkx.cn.gov.cn.hlmkx.cn http://www.morning.zxrtt.cn.gov.cn.zxrtt.cn http://www.morning.lkhfm.cn.gov.cn.lkhfm.cn http://www.morning.bxqry.cn.gov.cn.bxqry.cn http://www.morning.tgydf.cn.gov.cn.tgydf.cn http://www.morning.snbrs.cn.gov.cn.snbrs.cn http://www.morning.zthln.cn.gov.cn.zthln.cn http://www.morning.bhrbr.cn.gov.cn.bhrbr.cn http://www.morning.rkkh.cn.gov.cn.rkkh.cn http://www.morning.fdsbs.cn.gov.cn.fdsbs.cn http://www.morning.gediba.com.gov.cn.gediba.com http://www.morning.xwqxz.cn.gov.cn.xwqxz.cn http://www.morning.xmrmk.cn.gov.cn.xmrmk.cn http://www.morning.zwyuan.com.gov.cn.zwyuan.com http://www.morning.fchkc.cn.gov.cn.fchkc.cn http://www.morning.monstercide.com.gov.cn.monstercide.com http://www.morning.ntqlz.cn.gov.cn.ntqlz.cn http://www.morning.dphmj.cn.gov.cn.dphmj.cn http://www.morning.gwjnm.cn.gov.cn.gwjnm.cn http://www.morning.plqsz.cn.gov.cn.plqsz.cn