阿里Otter环境搭建及Demo

2019-06-22  本文已影响0人  1024_93d7

docker pull canal/otter-all

curl -fsSL https://raw.githubusercontent.com/alibaba/otter/master/docker/run.sh | bash

访问otter:http://192.168.102.212:8080

otter配置教程:https://blog.csdn.net/liupeifeng3514/article/details/79687095

要注意:otter拉取的主库,要打开binlog,并且是row模式,具体配置参考下文

SHOW VARIABLES LIKE 'log_%';

SHOW VARIABLES LIKE 'binlog_format%';

构建mysql docker服务

docker pull mysql:5.6

docker run -p 13306:3306 --name mysql-liukun -e MYSQL_ROOT_PASSWORD=123456 -d mysql:5.6

firewall-cmd --permanent --zone=public --add-port=13306/tcp

systemctl restart firewalld.service

apt-get update && apt-get -yq install vim

同理,再构建一个13307的mysql服务,13306作为源库,13307作为target

CREATE DATABASE /*!32312 IF NOT EXISTS*/`test` /*!40100 DEFAULT CHARACTER SET utf8 */;

USE test;

CREATE TABLE  `example` (

  `id` INT(11)  NOT NULL AUTO_INCREMENT,

  `name` VARCHAR(32) COLLATE utf8_bin DEFAULT NULL ,

  PRIMARY KEY (`ID`)

) ENGINE=INNODB DEFAULT CHARSET=utf8;

要改为阿里云的源,否则非常慢,更改方案参考下文

修改apt-get数据源为阿里云

cp /etc/apt/sources.list /etc/apt/sources.list.bak

echo "deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse" > /etc/apt/sources.list

apt update

apt-get install vim

有时候在执行apt update会报错W: GPG error: http://mirrors.aliyun.com/ubuntu bionic InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 3B4FE6ACC0B21F32

此时,执行apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 3B4FE6ACC0B21F32,注意最后的串号要相同

然后再执行apt update即可

vi visual模式 无法右键粘贴

vi ~/.vimrc

if has('mouse')

        set mouse-=a

endif

修改mysql 打开binlog为row模式

vi /etc/mysql/my.cnf

[mysqld]

log-bin=/var/lib/mysql/mysql-bin

binlog_format=ROW

将docker容器重启即可让配置生效

Hibernate源码,tomcat源码,spring源码

上一篇下一篇

猜你喜欢

热点阅读