Docker Installation Stand-alone Canal

I. Docker Installation

slightly

Modifying MySQL Configuration

2.1 Modify my.cnf configuration

For self-built MySQL, you need to turn on the Binlog write function, configure binlog-format as ROW mode, and configure it in my.cnf as follows

log-bin=mysql-bin 	# Open binlog
binlog-format=ROW 	# Select ROW mode
server_id=1 		# Configuring MySQL replacement requires definitions, not duplication with canal's slaveId

Remember to restart MySQL

2.2 New MySQL Users

Authorizing canal to link to MySQL account has the right to act as MySQL slave, if an existing account can grant directly

-- New user
CREATE USER canal IDENTIFIED BY 'canal';  

-- GRANT ALL PRIVILEGES ON *.* TO 'canal'@'%' ;
GRANT SELECT, REPLICATION SLAVE, REPLICATION CLIENT ON *.* TO 'canal'@'%';

-- Refresh authority
FLUSH PRIVILEGES;

III. Canal Admin Deployment

2.1 Download Mirror

docker hub

#Draw canal Admin image
$ docker pull canal/canal-admin:v1.1.4

2.2 Start Container

#Pull-up startup script
wget https://raw.githubusercontent.com/alibaba/canal/master/docker/run_admin.sh

#Run script
sh  run_admin.sh -e server.port=8089 \
         -e canal.adminUser=admin \
         -e canal.adminPasswd=admin

#View the startup log
$ docker logs canal-admin

DOCKER_DEPLOY_TYPE=VM
==> INIT /alidata/init/02init-sshd.sh
==> EXIT CODE: 0
==> INIT /alidata/init/fix-hosts.py
==> EXIT CODE: 0
==> INIT DEFAULT
Generating SSH1 RSA host key:                              [  OK  ]
Starting sshd:                                             [  OK  ]
Starting crond:                                            [  OK  ]
==> INIT DONE
==> RUN /home/admin/app.sh
==> START ...
start mysql ...
Starting mysqld:                                           [  OK  ]
start mysql successful
start admin ...
start canal successful
==> START SUCCESSFUL ...

2.3 View the Canal Admin UI page

IV. Deployment of Canal Server

docker hub

3.1 Pull Mirror

$ docker pull canal/canal-server:v1.1.4

3.2 Start Container

#Pull-up startup script
wget https://raw.githubusercontent.com/alibaba/canal/master/docker/run.sh

#Run script
sh run.sh -e canal.admin.manager=192.168.25.142:8089 \
          -e canal.admin.port=11110 \
          -e canal.admin.user=admin \
          -e canal.admin.passwd=4ACFE3202A5FF5CF467898FC58AAB1D615029441
          
#View Container Log
$ docker logs canal-server

DOCKER_DEPLOY_TYPE=VM
==> INIT /alidata/init/02init-sshd.sh
==> EXIT CODE: 0
==> INIT /alidata/init/fix-hosts.py
==> EXIT CODE: 0
==> INIT DEFAULT
Generating SSH1 RSA host key:                              [  OK  ]
Starting sshd:                                             [  OK  ]
Starting crond:                                            [  OK  ]
==> INIT DONE
==> RUN /home/admin/app.sh
==> START ...
start canal ...
start canal successful
==> START SUCCESSFUL ...

3.3 Check Canal Admin

5. Adding instance s

4.1 Additional Examples

4.2 View Logs

Note to see if there are any exceptions. The status indicates success for startup

6. Subscription Consumption of Canal Client

5.1 Pull Git Code

$ git clone https://github.com/alibaba/canal.git

5.2 Start Clinet Consumption Service

5.3 Insert Data

5.4 View Console Log

Tags: Operation & Maintenance MySQL Docker git github

Posted on Mon, 07 Oct 2019 15:10:43 -0700 by illzz