5.目标端开启实时数据同步
./ggsci GGSCI (172-16-101-242) 7> start replicat repkfk Sending START request to MANAGER ... REPLICAT REPKFK startingGGSCI (172-16-101-242) 8> info all Program Status Group Lag at Chkpt Time Since ChkptMANAGER RUNNING REPLICAT RUNNING REPKFK 00:00:00 00:00:00
6.测试增量数据同步
Oracle插入增量数据
SQL> insert into baiyang.ora_to_kfk select OWNER, OBJECT_NAME, SUBOBJECT_NAME, OBJECT_ID, DATA_OBJECT_ID, OBJECT_TYPE from all_objects where object_id >500 and object_id < 1000; SQL> commit; SQL> select count(*) from baiyang.ora_to_kfk;COUNT(*) ---------- 905
查看Kafka消息队列消费数据
{"table":"BAIYANG.ORA_TO_KFK","op_type":"I","op_ts":"2019-11-11 21:04:11.158786","current_ts":"2019-11-11T21:10:54.042000","pos":"00000000000000075298","after":{"OWNER":"SYS","OBJECT_NAME":"APPLY$_READER_STATS","SUBOBJECT_NAME":null,"OBJECT_ID":998,"DATA_OBJECT_ID":998,"OBJECT_TYPE":"TABLE"}} {"table":"BAIYANG.ORA_TO_KFK","op_type":"I","op_ts":"2019-11-11 21:04:11.158786","current_ts":"2019-11-11T21:10:54.042001","pos":"00000000000000075459","after":{"OWNER":"SYS","OBJECT_NAME":"APPLY$_READER_STATS_I","SUBOBJECT_NAME":null,"OBJECT_ID":999,"DATA_OBJECT_ID":999,"OBJECT_TYPE":"INDEX"}}
源端Oracle删除数据
SQL> delete from baiyang.ora_to_kfk ; 906 rows deleted. SQL> commit;
查看kafka消息队列消费数据
{"table":"BAIYANG.ORA_TO_KFK","op_type":"D","op_ts":"2019-11-11 21:13:11.166184","current_ts":"2019-11-11T21:13:17.449007","pos":"00000000000000216645","before":{"OWNER":"x1","OBJECT_NAME":"SSSSS","SUBOBJECT_NAME":"z1","OBJECT_ID":111000,"DATA_OBJECT_ID":2000,"OBJECT_TYPE":"x1"}}
源端插入数据
SQL> insert into baiyang.ora_to_kfk values('汉字', 'y1', 'z1', 111000,2000,'x1'); 1 row created. SQL> commit;
查看kafka消息队列消费数据
{"table":"BAIYANG.ORA_TO_KFK","op_type":"I","op_ts":"2019-11-11 21:14:21.167454","current_ts":"2019-11-11T21:14:26.497000","pos":"00000000000000216794","after":{"OWNER":"汉字","OBJECT_NAME":"y1","SUBOBJECT_NAME":"z1","OBJECT_ID":111000,"DATA_OBJECT_ID":2000,"OBJECT_TYPE":"x1"}}
总结使用OGG可以方便地将Oracle的数据变更情况实时同步到Kafka消息队列 。下游业务系统通过订阅kafka的消息队列,能方便地实现各类实时数据的应用 。
推荐阅读
- Nginx 整合 FastDFS 实现文件服务器
- 熔断原理与实现Golang版
- 不拆分网线,一根网线实现IPTV和上网单线复用,手把手超详细
- ThinkPHP框架——实现定时任务,定时更新、清理数据
- SpringBoot如何用Session共享实现分布式部署?
- sync-player使用websocket实现异地同步播放
- 物联网网关搭建VPN客户端,来实现PLC远程下载
- H5 实现二维码 / 条形码的识别与解析
- 常做这运动让身体器官更年轻 助你实现长寿梦想
- 带你实现一个静态服务器,超详细