当前位置:网站首页>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

边栏推荐
- Internet cafe management system and database
- c#:互斥锁的使用
- Domain name purchase method good domain name selection principle
- 记录--关于JSP前台传参数到后台出现乱码的问题
- Counter attack of flour dregs: MySQL 66 questions, 20000 words + 50 pictures
- Arduino融资3200万美元,进军企业市场
- .NET7之MiniAPI(特别篇) :Preview5优化了JWT验证(上)
- Accumulateur Spark et variables de diffusion
- Application configuration management, basic principle analysis
- What are the easy-to-use character recognition software? Which are the mobile terminal and PC terminal respectively
猜你喜欢
随机推荐
Let's talk about BOM and DOM (5): dom of all large Rovers and the pits in BOM compatibility
Cloud native high availability and Disaster Recovery Series (I): pod break up scheduling
On BOM and DOM (6): bit value calculation of DOM objects and event objects, such as offsetx/top and clearx
leetcode:84. 柱状图中最大的矩形
Cloudcompare & PCL point cloud clipping (based on clipping box)
十年
leetcode:85. 最大矩形
Why use lock [readonly] object? Why not lock (this)?
How to register the cloud service platform and what are the advantages of cloud server
Surveying and mapping principle of GIS coordinate system: geoid / datum / reference ellipsoid /epsg/sri/wkt
Typora收费?搭建VS Code MarkDown写作环境
Spark项目打包优化实践
leetcode:84. The largest rectangle in the histogram
What is the main function of cloud disk? How to restore deleted pictures
[5 minutes to play lighthouse] take you to the light kubernetes release k3s
[binary number learning] - Introduction to trees
You have a chance, here is a stage
Deploy DNS server using dnsmasq
Virtual file system
应用配置管理,基础原理分析








