码迷,mamicode.com
首页 > 其他好文 > 详细

安装canal

时间:2018-02-25 13:05:50      阅读:507      评论:0      收藏:0      [点我收藏+]

标签:mkdir   url   选择   iba   oca   logs   mysql-bin   alibaba   dep   

一、安装前准备

配置Mysql:

[mysqld]  
log-bin=mysql-bin #添加这一行就ok  
binlog-format=ROW #选择row模式  
server_id=1 #配置mysql replaction需要定义,不能和canal的slaveId重复  

/etc/init.d/mysqld restart #重启mysql

在mysql中 配置canal数据库管理用户,配置相应权限(repication权限)

CREATE USER canal IDENTIFIED BY 'canal';    
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';  
-- GRANT ALL PRIVILEGES ON *.* TO 'canal'@'%' ;  
FLUSH PRIVILEGES;  

二、部署canal

下载地址:
https://github.com/alibaba/canal/releases

下载安装包:
https://github.com/alibaba/canal/releases/download/v1.0.25/canal.deployer-1.0.25.tar.gz

解压安装:

cd /usr/local/src/
mkdir canal
tar -xf canal.deployer-1.0.25.tar.gz -C canal
mv canal /usr/local/

canal文件目录结构:

[root@erpdev01 canal]# ll
total 4
drwxr-xr-x 2 root root   75 Feb  6 15:14 bin
drwxr-xr-x 4 root root   78 Feb  6 15:13 conf
drwxr-xr-x 2 root root 4096 Feb  6 14:54 lib
drwxrwxrwx 4 root root   34 Feb  6 14:57 logs

三、配置canal

修改配置canal配置文件:
vim conf/example/instance.properties

#################################################
## mysql serverId
canal.instance.mysql.slaveId=1234
# position info
canal.instance.master.address=127.0.0.1:3306
canal.instance.master.journal.name=
canal.instance.master.position=
canal.instance.master.timestamp=


# table meta tsdb info
#canal.instance.tsdb.enable=false
#canal.instance.tsdb.dir=${canal.file.data.dir:../conf}/${canal.instance.destination:}
#canal.instance.tsdb.url=jdbc:h2:${canal.instance.tsdb.dir}/h2;CACHE_SIZE=1000;MODE=MYSQL;
#canal.instance.tsdb.url=jdbc:mysql://127.0.0.1:3306/canal_tsdb
#canal.instance.tsdb.dbUsername=canal
#canal.instance.tsdb.dbPassword=canal


#canal.instance.standby.address =   
#canal.instance.standby.journal.name =  
#canal.instance.standby.position =  
#canal.instance.standby.timestamp = 
# username/password
canal.instance.dbUsername=canal
canal.instance.dbPassword=canal
canal.instance.defaultDatabaseName=   #去除test
canal.instance.connectionCharset=UTF-8
# table regex
canal.instance.filter.regex=.*\\..*
# table black regex
canal.instance.filter.black.regex=
#################################################

vim conf/canal.properties

#canal.instance.tsdb.spring.xml=classpath:spring/tsdb/h2-tsdb.xml #禁止tsdb

四、启动和停止canal:

./bin/startup.sh 或者 ./bin/stop.sh 

安装canal

标签:mkdir   url   选择   iba   oca   logs   mysql-bin   alibaba   dep   

原文地址:https://www.cnblogs.com/luchuangao/p/8468944.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!