测试题目:canal-client的HA功能验证
测试平台:CentOS Linux release 7.1.1503 (Core) mariadb版本:10.1.14-MariaDB Canal版本:1.0.23
测试方案:
在测试机部署两台canal-server,配置为:172.17.1.181:22220和172.17.1.181:22221
部署一台mariadb:172.17.1.181:3306
测试步骤:
1.启动多个canal-client进程:
[
[email protected] client]$ java -Djava.ext.dirs=lib1.0.23 com.yc.otter.client.ClusterCanalClient linwenxue > log/client-cluster1.log 2>&1 &
[1] 140079
[
[email protected] client]$ java -Djava.ext.dirs=lib1.0.23 com.yc.otter.client.ClusterCanalClient linwenxue > log/client-cluster2.log 2>&1 &
[2] 140151
[
[email protected] client]$ java -Djava.ext.dirs=lib1.0.23 com.yc.otter.client.ClusterCanalClient linwenxue > log/client-cluster3.log 2>&1 &
[3] 142007
2.顺序间隔一会关闭client1和client2进程:
3.观察输出日志:
【
log/client-cluster1.log】
10-25-15:23:28 INFO Entry MetaInfo: schema is canal_test, table is canal_mariadb_test
-------------------EventType.INSERT start-------------------
id :
1 type=int(10) update=true
name : a type=varchar(20) update=true
age : 1 type=int(4) update=true
department : A type=varchar(20) update=true
-------------------EventType.INSERT end---------------------
................
省略中间日志............
10-25-15:23:48 INFO Entry MetaInfo: schema is canal_test, table is canal_mariadb_test
-------------------EventType.INSERT start-------------------
id :
2496 type=int(10) update=true
name : a type=varchar(20) update=true
age : 1 type=int(4) update=true
department : A type=varchar(20) update=true
-------------------EventType.INSERT end---------------------
EventType is TRANSACTIONEND
********************************获取messageId:455,解析消息结束**********************************
10-25-15:23:48 INFO ********************************获取messageId:455,解析消息结束**********************************
10-25-15:23:48 INFO ##
canal client is down.
==========================client-cluster1.log结束====================
【
log/client-cluster2.log】
10-25-15:23:53 INFO Entry MetaInfo: schema is canal_test, table is canal_mariadb_test
-------------------EventType.INSERT start-------------------
id :
2497 type=int(10) update=true
name : a type=varchar(20) update=true
age : 1 type=int(4) update=true
department : A type=varchar(20) update=true
-------------------EventType.INSERT end---------------------
................
省略中间日志............
-------------------EventType.INSERT end---------------------
EventType is TRANSACTIONEND
10-25-15:24:11 INFO Entry MetaInfo: schema is canal_test, table is canal_mariadb_test
-------------------EventType.INSERT start-------------------
id :
5462 type=int(10) update=true
name : a type=varchar(20) update=true
age : 1 type=int(4) update=true
department : A type=varchar(20) update=true
-------------------EventType.INSERT end---------------------
EventType is TRANSACTIONEND
********************************获取messageId:882,解析消息结束**********************************
10-25-15:24:11 INFO ********************************获取messageId:882,解析消息结束**********************************
10-25-15:24:11 INFO ## canal client is down.
==========================client-cluster2.log结束====================
【
log/client-cluster3.log】
10-25-15:24:17 INFO Entry MetaInfo: schema is canal_test, table is canal_mariadb_test
-------------------EventType.INSERT start-------------------
id :
5463 type=int(10) update=true
name : a type=varchar(20) update=true
age : 1 type=int(4) update=true
department : A type=varchar(20) update=true
-------------------EventType.INSERT end---------------------
................
省略中间日志............
10-25-15:29:53 INFO Entry MetaInfo: schema is canal_test, table is canal_mariadb_test
-------------------EventType.INSERT start-------------------
id :
50000 type=int(10) update=true
name : a type=varchar(20) update=true
age : 1 type=int(4) update=true
department : A type=varchar(20) update=true
-------------------EventType.INSERT end---------------------
测试结果:在50000条数据录入的情况,canal-client实现了HA功能,不存在重复和缺失数据情况