当前位置:网站首页>Canal安装配置
Canal安装配置
2022-06-24 06:39:00 【Angryshark_128】
资源下载
链接:https://pan.baidu.com/s/1wKqJ0VypFxKd6WnJxIoEqg
提取码:wrmf
配置Mysql
新建canal库
CREATE USER canal IDENTIFIED BY 'canal';
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';
FLUSH PRIVILEGES;
解压至目录
> tar -xf canal.deployer-1.1.5-SNAPSHOT.tar.gz -C /pandora/soft/canal-1.1.5
修改配置文件
> vi /pandora/soft/canal-1.1.5/conf/canal.properties
# 设置数据库实例
canal.destinations = oidd
> cp -R example/ oidd
> cd /pandora/soft/canal-1.1.5/conf/oidd
> vi instance.properties
# 要监控的数据库地址
canal.instance.master.address=127.0.0.1:30000
# 数据库用户名
canal.instance.dbUsername = canal
# 数据库密码
canal.instance.dbPassword = canal
# 指定需要同步的数据库
canal.instance.defaultDatabaseName = oidd
# 指定编码方式
canal.instance.connectionCharset = UTF-8
启动Canal
> cd /pandora/soft/cannal-1.1.5/bin
> ./startup.sh
打开Canal样例项目运行


修改参数:IP 端口 数据库 用户名 密码
package com.alibaba.otter.canal.example;
import java.net.InetSocketAddress;
import com.alibaba.otter.canal.client.CanalConnector;
import com.alibaba.otter.canal.client.CanalConnectors;
import com.alibaba.otter.canal.common.utils.AddressUtils;
/**
* 单机模式的测试例子
*
* @author jianghang 2013-4-15 下午04:19:20
* @version 1.0.4
*/
public class SimpleCanalClientTest extends AbstractCanalClientTest {
public SimpleCanalClientTest(String destination) {
super(destination);
}
public static void main(String[] args) {
// 根据ip,直接创建链接,无HA的功能
String destination = "oidd";
String ip = "106.13.73.198";
Integer port = 11111;
String userName = "canal";
String password = "canal";
CanalConnector connector = CanalConnectors.newSingleConnector(new InetSocketAddress(ip, port),
destination,
userName,
password);
final SimpleCanalClientTest clientTest = new SimpleCanalClientTest(destination);
clientTest.setConnector(connector);
clientTest.start();
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
try {
logger.info("## stop the canal client");
clientTest.stop();
} catch (Throwable e) {
logger.warn("##something goes wrong when stopping canal:", e);
} finally {
logger.info("## canal client is down.");
}
}
});
}
}
创建新表
use oidd;
CREAETE TABLE ***
可以看到最新的LOG

边栏推荐
- 线程安全与实现方法
- Brief introduction of domain name registration
- puzzle(019.1)Hook、Gear
- How do I turn off win10 automatic update? What are the good ways?
- leetcode:85. Max rectangle
- 展锐芯片之GPU频率
- 网吧管理系统与数据库
- How to build an app at low cost
- Oracle SQL comprehensive application exercises
- Basic knowledge of wechat applet cloud development literacy chapter (I) document structure
猜你喜欢
随机推荐
How to send SMS in groups? What are the reasons for the poor effect of SMS in groups?
What is the OSI seven layer model? What is the role of each layer?
原神方石机关解密
Leetcode: Sword finger offer 26: judge whether T1 contains all topologies of T2
Cloudcompare & PCL point cloud clipping (based on clipping box)
How to make a website? What should I pay attention to when making a website?
【愚公系列】2022年6月 ASP.NET Core下CellReport报表工具基本介绍和使用
Do you know about Statistics?
[JUC series] completionfuture of executor framework
Project demo
目标5000万日活,Pwnk欲打造下一代年轻人的“迪士尼乐园”
Interpreting top-level design of AI robot industry development
What is the main function of cloud disk? How to restore deleted pictures
Become TD hero, a superhero who changes the world with Technology | invitation from tdengine community
Localized operation on cloud, the sea going experience of kilimall, the largest e-commerce platform in East Africa
JSON online parsing and the structure of JSON
decade
数据同步工具 DataX 已经正式支持读写 TDengine
On BOM and DOM (6): bit value calculation of DOM objects and event objects, such as offsetx/top and clearx
go 断点续传




![[JUC series] completionfuture of executor framework](/img/d0/c26c9b85d1c1b0da4f1a6acc6d33e3.png)




