1、查看mysql

连接外网mysq游戏服,确保登得上

mysql -hxxxxxxx -P3336 -umaxwell -pmaxwell\
#查看binlog格式,确保为row
select @@binlog_format;

2、配置maxwell

分两种情况,A:新加实例为新游戏或新版本 B:添加实例为某游戏某版本服务器追加
A情况需要比B多一步创建文件操作,且需要通知大数据通知创建对应的kafka主题

cd /data/maxwell

//此目录下可以看到类似config.properties.ylyh.hk,config.properties.rs.bm,后面两位分别为产品名+版本
//复制相同产品名的文件,修改文件名后缀为对应版本

cp config.properties.ylyh.hk config.properties.ylyh.xx
vim config.properties.ylyh.xx

//新游戏没有模板样例可让大数据同事先创建
maxwell配置文件内容

3.批量生成配置文件

启动 /data/etl/scripts/create_supervisord_for_address.py

python3 create_supervisord_for_address.py  -c 192.168.1.246,192.168.1.225 --group 1  -u maxwell -pmaxwell -P 3336 --product ix --product_version cn

执行supervisorctl update,*supervisorctl *再执行并查看状态。

4.检查maxwell是否报错

检查maxwell是否报错

 tail -n 20 /data/etl/logs/maxwell_* | grep -E '==>|ERROR|log file name|Exception'

稳一点查对应的日志文件,刚刚添加的机器ip

tail -f /data/etl/logs/maxwell/maxwell_ylyh_{v}_{ip}.log 
48603 [INFO] Metadata: Cluster ID: bPI45fG4Q2-YQ6_wtcecxw
48615 [INFO] MysqlSavedSchema: Restoring schema id 2 (last modified at Position[BinlogPosition[mysql-bin.000906:202302982], lastHeartbeat=0])
73230 [INFO] BinlogConnectorReplicator: Setting initial binlog pos to: mysql-bin.001844:25466155
74212 [INFO] BinaryLogClient: Connected to 161.117.229.58:3336 at mysql-bin.001844/25466155 (sid:6379, cid:897974)
74223 [INFO] BinlogConnectorReplicator: Binlog connected.

最后一行显示Binlog connected则代表同步正常,若没有则未能正常同步

注:本文档供运维同事辅助添加数据同步,新游戏或新版本添加需通知大数据同事,因为还有其他操作在此文档前后需要执行