维护步骤:
-
登录到ES服务器:192.168.111.141。
-
停止 Canal 和 Canal-Adapter 服务:
cd /home/xiangtan/canal/bin ./stop.sh cd /home/xiangtan/canal-adapter/bin ./stop.sh
-
确定修改了主键值的表,例如 tbl_sparking,使用 Logstash 手动同步数据:
cd /home/xiangtan/canal-adapter/elk sudo /usr/share/logstash/bin/logstash -f 8-tbl_sparking.conf
-
同步完成后,启动 Canal 服务,查看日志以确保启动成功:
cd /home/xiangtan/canal/bin ./start.sh tail -f /home/xiangtan/canal/logs/example/example.log
如果出现错误,需要先停止 Canal,然后删除
/home/xiangtan/canal/conf/example
下的meta.dat
文件,再启动 Canal。 -
当 Canal 服务正常后,启动 Canal-Adapter 服务,并查看日志:
cd /home/xiangtan/canal-adapter/bin ./start.sh tail -f /home/xiangtan/canal-adapter/logs/adapter/adapter.log
-
数据可能仍然不完整,需要使用 Logstash 手动同步全部数据:
cd /home/xiangtan/canal-adapter/elk sudo /usr/share/logstash/bin/logstash -f 1-tbl_ps_device_info.conf sudo /usr/share/logstash/bin/logstash -f 2-tbl_video_device_info.conf sudo /usr/share/logstash/bin/logstash -f 3-tbl_ps_order_in.conf sudo /usr/share/logstash/bin/logstash -f 4-tbl_ps_order_out.conf sudo /usr/share/logstash/bin/logstash -f 5-tbl_user_info.conf sudo /usr/share/logstash/bin/logstash -f 6-tbl_order_in_pay_log.conf sudo /usr/share/logstash/bin/logstash -f 7-tbl_order_out_pay_log.conf sudo /usr/share/logstash/bin/logstash -f 8-tbl_sparking.conf sudo /usr/share/logstash/bin/logstash -f 9-tbl_account_payment_log.conf sudo /usr/share/logstash/bin/logstash -f 10-tbl_parking_manager.conf sudo /usr/share/logstash/bin/logstash -f 11-tbl_bat_txn.conf sudo /usr/share/logstash/bin/logstash -f 12-tbl_bat_pay_txn.conf sudo /usr/share/logstash/bin/logstash -f 13-tbl_bse_info_mchnt.conf
这些步骤可帮助您维护服务器,确保 Canal 和 Canal-Adapter 服务正常运行,并手动同步数据以确保数据完整性。
最后把监控加上
cd /home/xiangtan/canal-adapter/logs/adapter
nohup ./monitor.sh &