Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Installation and use of Canal

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains the "installation and use of Canal", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "the installation and use of Canal" bar!

.

1. First configure mysql:

Mysql turns on binlog mode

(1) check whether the current mysql enables binlog mode.

SHOW VARIABLES LIKE'% log_bin%'

If the value of log_bin is OFF is not enabled, the value of ON is enabled.

(2) to modify / etc/my.cnf, you need to enable binlog mode.

After the modification is complete, restart the service of mysqld.

two。 Install canal

Download canal

Https://github.com/alibaba/canal/releases/tag/canal Murray 1.0.2

Download and upload to linux for decompression

Extract the completed directory

Modify conf/example/instance.properties configuration file

Configure the address and account password of mysql

Then start canal

Check the log and start successfully

2: data monitoring

Download https://github.com/chenqian56131/spring-boot-starter-canal

Install to maven warehouse to realize data monitoring

Create a springboot project to introduce the dependencies that have just been installed into the maven repository

Com.xpand

Starter-canal

0.0.1-SNAPSHOT

Add configuration to application.properties configuration file

Canal.client.instances.example.host=192.168.63.128

Canal.client.instances.example.port=11111

The code is

Any table that changes any library of the mysql will receive the data before and after the change.

This note can listen to delete add modify operation to add parameters to specify library tables, without parameters all library tables

@ ListenPoint (destination = "example", schema = "test", table = {"class"})

This note can monitor the modification operation to add parameters to specify the library table, without adding parameters to all library tables.

@ UpdateListenPoint (schema = "test", table = {"class"})

This note can monitor the add operation to add parameters to specify the library table, without adding parameters to all library tables.

@ InsertListenPoint

This note can monitor the delete operation to add parameters to specify database tables, without adding parameters to all library tables.

@ DeleteListenPoint

Thank you for your reading, the above is the content of "the installation and use of Canal". After the study of this article, I believe you have a deeper understanding of the installation and use of Canal, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report