Compare commits

...
Author SHA1 Message Date
jianghang.loujh a96db39420 add polardb-x parser test 2022-06-13 09:39:29 +08:00
温绍锦 bac1d543f1 update fastjson & druid version (#4224)
* 修复升级2.0.4导致兼容的问题

* update druid & fastjson version
2022-06-13 09:31:46 +08:00
jianghang.loujh 753fad6639 fixed issue #4216 , support polardb-x show tables 2022-06-10 13:36:39 +08:00
jianghang.loujh bc4dceea1a fixed issue #4216 , support polardb-x show databases 2022-06-10 11:37:52 +08:00
温绍锦 7aaee7b439 修复升级2.0.4导致兼容的问题 (#4202) 2022-05-30 10:29:38 +08:00
温绍锦 e19bf1ecff Fastjson2 compatible fix (#4189)
* update fastjson2 version, 2.0.2 -> 2.0.3

* update fastjson & druid version

* bug fix for fastjson2 compatible
2022-05-25 10:22:26 +08:00
jianghang.loujh a99dc0cbe8 fixed testcase 2022-05-24 11:18:40 +08:00
jianghang.loujh 7b8ff04d20 [maven-release-plugin] prepare for next development iteration 2022-05-24 10:26:12 +08:00
jianghang.loujh 7ee246ca5a [maven-release-plugin] prepare release canal-1.1.6 2022-05-24 10:26:06 +08:00
jianghang.loujh 54c645f315 fixed test failed 2022-05-24 10:12:26 +08:00
jianghang.loujh 6c81ab6fdc fixed compiler error 2022-05-24 10:08:02 +08:00
jianghang.loujh 99aefaa118 support mysql 8.0 transaction_payload_event 2022-05-23 23:23:52 +08:00
jianghang.loujh e2248b3d35 update phoenix pom.xml 2022-05-23 19:30:19 +08:00
jianghang.loujh eef1ee85fb fixed issue #4014, support java8 & java11 G1 GC 2022-05-23 18:23:31 +08:00
温绍锦 7dfec19c68 update druid & fastjson2 version (#4183)
* update fastjson2 version, 2.0.2 -> 2.0.3

* update fastjson & druid version
2022-05-23 10:03:41 +08:00
jianghang.loujh 05a52f1bd3 upgrade log4j version 2022-05-20 16:58:20 +08:00
jianghang.loujh fb0f274ba8 fixed logger 2022-05-20 16:09:53 +08:00
jianghang.loujh d71a208123 fixed issue #4178 , support -00:00:00.12 2022-05-20 10:37:53 +08:00
jianghang.loujh 656a1d23c2 instance.properties demo 2022-05-19 19:56:50 +08:00
jianghang.loujh a574b91fdf fixed #3976 , support LogEvent.MYSQL_TYPE_TYPED_ARRAY 2022-05-19 19:53:54 +08:00
jianghang.loujh e41e903984 fixed issue #3538 , compatiable mysql8.0 filed meta 2022-05-17 17:17:32 +08:00
jianghang.loujh 4a22d72ef4 fixed issue #4018, fixed CanalInstanceWithManager thread-safe 2022-05-16 19:46:34 +08:00
jianghang.loujh b7eff723a3 fixed issue #4027, CanalServerWithEmbedded.get support newList 2022-05-16 19:41:46 +08:00
jianghang.loujh 9b9cfe4037 fixed issue #4152, TableMetaTSDB support canal.instance.filter.query.ddl=true 2022-05-16 17:25:43 +08:00
jianghang.loujh ee51f338e0 fixed outAdapterkey autoGen 2022-05-13 15:13:14 +08:00
zhuchao941andagapple 4315f203a2 repair issue #3401 (#3923)
* 解决OutAdapter单例导致的问题,如 1.多个es7 outAdapter的多线程问题(共享同一个es bulk request),2.多个es7 outAdapter共用一份es配置问题

* 1. 优化adapter和监听器之间的代码结构
2. 监听器只处理匹配的配置文件
3. bugfix-es adapter配置文件回调时漏写esVersion
理论上一个adapter实例对应一个config配置文件

Co-authored-by: agapple <jianghang.loujh@alibaba-inc.com>
2022-05-13 15:02:06 +08:00
jianghang.loujh b12945d4a9 format yml 2022-05-13 14:39:57 +08:00
885f05fb6a 支持定义rocketmq client日志路径,及修复一些bug (#3229)
* 修复接入阿里云RocketMq no route info for this topic 问题

* 支持deployer同步rocketmq时定义rocketmq client日志路径

* 支持deployer同步rocketmq时定义rocketmq client日志路径

* 回退guava版本号,解决adapter的java.lang.NoSuchMethodError: com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor()异常

* 解决adapter启动报com.alibaba.druid.pool.DruidDataSource cannot be cast to com.alibaba.druid.pool.DruidDataSource异常。

* 支持rocketmq client 配置日志路径

Co-authored-by: hai.yu <hai.yu@snowballtech.com>
Co-authored-by: agapple <jianghang.loujh@alibaba-inc.com>
2022-05-13 14:39:29 +08:00
ChengTie(鐵手) 591126ee6b update (#3326) 2022-05-13 14:37:17 +08:00
He Wang af432bf10a fix data truncated for column issue for type year (#3866) 2022-05-13 14:33:06 +08:00
jumao b532e90ff4 ESAdapter Support the same instance cross -library query (#4161)
* ESAdapter Support the same instance cross -library query

* fix null point ex
2022-05-13 14:31:09 +08:00
xiaoyu.zhang e48bc35f35 通过索引别名获取mapping,返回数据为真实索引,而不是别名,导致mappings.get(index).get(type)报空指针异常 (#4122) 2022-05-13 14:28:53 +08:00
He Wang 11a5f2a0fa add druid stat filter (#3985) 2022-05-13 14:24:37 +08:00
He Wangandagapple c775478a56 set backtick by DbType (#3984)
Co-authored-by: agapple <jianghang.loujh@alibaba-inc.com>
2022-05-13 14:23:40 +08:00
He Wang bd1f91cd9c fix sync order in RdbMirrorDbSyncService (#3928) 2022-05-13 14:19:40 +08:00
jianghang.loujh 67e85d201c remove client adapter Docker 2022-05-13 12:46:12 +08:00
wanglei 6965726dfe fix bug #2023 (#3871)
* fix bug #2023

* 配置canal-adapter,docker生成脚本
2022-05-13 12:39:43 +08:00
willmao c0001afe8f use hostname if register name not set (#3968) 2022-05-13 12:24:33 +08:00
xiayingfeng 977031a666 Improve MAVEN build Performance (#4055) 2022-05-13 12:23:33 +08:00
zhangshaoning bd3224eea1 Upgrade reference log4j package version (#4017) 2022-05-13 12:22:45 +08:00
jianghang.loujh 33733aef25 fixed compatible and code format 2022-05-13 11:59:57 +08:00
zhangjukai 25be0259a4 Some tweaks for pulsarmq-connector (#4060)
* 1. Add the com.alibaba.otter.canal.connector.core.spi.CanalMsgConsumer file to the META-INF/canal directory under the pulsarmq-connector project
2. Introduce pulsar-client-admin for Canal to automatically create multi-partition topics
3. Add the judgment that roleToken is null
4. The disconnect method in CanalPulsarMQConsumer removes this.pulsarMQConsumer.unsubscribe();, this code will cause data loss during stop
5. When getting Pulsar messages, they are all processed as flat messages, because CanalMessageSerializerUtil.deserializer(data) will deserialize exceptions
6. Use groupId as subscriptName, without the pulsarmq.subscriptName parameter, the entire adapter will be the same subscriber name using pulsarmq.subscriptName

* 逻辑优化

* 代码优化

* 针对pulsar的调整

* 恢复代码

* 恢复代码

* 处理Producer失效的情况
2022-05-13 11:41:50 +08:00
liteng2430 8114d77a20 Add verification: the user can set a password with a length of less than 6 digits when updating the password, but the password length must be greater than or equal to 6 digits when logging in to canal admin, so the length verification function when updating the login password is added (#4103) 2022-05-13 11:34:36 +08:00
ZhangJian He 571e7f4e25 fix ojdbc6 wrong corrinator (#4132) 2022-05-13 11:33:42 +08:00
温绍锦 ead91433d7 fastjson update 1.x to 2.0.2 (#4160) 2022-05-13 11:32:47 +08:00
xiaoma20082008 bac016f89e <feat>: support visibility columns (#3976) 2022-05-13 11:30:19 +08:00
willmao 8804647c30 avoid print password when logging (#3969) 2022-05-13 11:28:05 +08:00
mclubing 2623d08b8c rdb配置不支持yaml后缀文件 (#3964)
增加rdb配置支持yaml后缀文件
2022-05-13 11:26:04 +08:00
wuare 622fed84ce fixed logger name (#3887) 2022-05-13 11:24:00 +08:00
He Wang 9f5e8fd1c4 rollback guava version in adapter module (#3880) 2022-05-13 11:23:30 +08:00
Junwang Zhao 88d472ef1e move protocol test to protocol test directory (#3864)
1. move the protocol test to right directory
2. fix wrong string format params count

Signed-off-by: 元组 <zhaojunwang.zjw@alibaba-inc.com>
2022-05-13 11:16:06 +08:00
Aiden.Ao 2987d08161 fix issue #3144 (#3712) 2022-05-13 11:09:09 +08:00
tuple b54bea5e33 polish the code thus make it more stable (#3855)
Signed-off-by: 元组 <zhaojunwang.zjw@alibaba-inc.com>
2021-10-11 14:46:22 +08:00
jianghang.loujh c42ba95eed fixed pulsarmq package 2021-10-09 18:06:34 +08:00
jianghang.loujh b48c434ffd fixed phoenix version 2021-10-09 17:52:13 +08:00
jianghang.loujh 2c892fce9b fixed issue #3484 , fixed bat script 2021-10-09 17:39:22 +08:00
jianghang.loujh 3bb49e19d2 fixed issue #3576, stop exporter 2021-10-09 17:29:23 +08:00
jianghang.loujh f26b84ffc2 fixed issue #3829 , kafka connector support k8s env 2021-10-09 16:31:59 +08:00
364102729andagapple 0a2254eeaf add tablestore adapter (#3754)
* add tablestore adapter

* add tablestore adapter

* fix bug add add log when etl fail

* fix bug,tinyint(1)以及rowupdatechange

Co-authored-by: agapple <jianghang115@gmail.com>
2021-10-09 16:06:13 +08:00
jianghang.loujh 40d840375f fixed MR 2021-10-09 15:59:12 +08:00
Chad2liandagapple 5b6fd8094a 增加Apache Pulsar MQ支持 (#3791)
* done pulsarmq

* del pulsar consumer

* pulsar partition

* done pulsar consumer&connector

* update pulsar-client version to 2.8.1

Co-authored-by: agapple <jianghang115@gmail.com>
2021-10-09 15:51:45 +08:00
mikoto 4ce401d219 fix: 多destination的场景下只能生效一个 (#3772) 2021-10-09 15:38:26 +08:00
Jonathan SchneiderandModerne de95a6a128 refactor: Use Java standard library instead of Guava (#3708)
Co-authored-by: Moderne <team@moderne.io>

Co-authored-by: Moderne <team@moderne.io>
2021-10-09 15:33:37 +08:00
happyrita 9e11c3c018 定时保存snapshot到DB的逻辑中,schema名称获取错误,在有配置canal.instance.filter.regex时,由于对应的table无法被匹配中,导致compareTableMetaDbAndMemory方法不被执行 (#3693)
* 避免重复订阅zk变更状态

* Update DatabaseTableMeta.java

获取schema的名称

* Update CanalController.java
2021-10-09 15:32:20 +08:00
arthasking123 d67bea8f3d repair issue #3678,#3680 (#3684)
* repair issue #3678,#3680

* repair issue #3678,#3680
2021-10-09 15:30:32 +08:00
kkjinping 997957d6e0 新增配置 canal.mq.enableDynamicQueuePartition,获取topic对应的队列的数量为分区的数量,以支持动态队列的场景(如阿里云的rocketmq,无法人工设置队列数量,可能会动态伸缩) (#3670) 2021-10-09 15:26:23 +08:00
tanpenggood ea20076a32 fix: rowChange typo (#3593) 2021-10-09 15:23:36 +08:00
dinosaur 2550d8eb65 Connection is already closed fix (#3587) 2021-10-09 14:54:05 +08:00
nick 31a0fdc807 add note (#3550) 2021-10-09 14:53:28 +08:00
lanicc d79431c7e5 fix typo (#3532) 2021-10-09 14:53:00 +08:00
ruanjl 911711248c 修复rds高可用主从切换和oss相关问题 (#3480)
* 修复rds oos 拉取的binlog 的消费逻辑以及本地消费到直连消费的逻辑衔接

* 去除无用代码
2021-10-09 14:51:41 +08:00
sparkandlihuav2017 63407dc570 canal adapter phoenix (#3290)
* canal adapter phoenix

* canal adapter phoenix

* canal adapter phoenix

* canal adapter phoenix

* canal adapter phoenix

* canal adapter phoenix

* canal adapter phoenix

Co-authored-by: lihuav2017 <lihua@able-elec.com>
2021-10-09 14:37:11 +08:00
flowell 3c20fd09ad fix issue #3839: 修复alter table character set类型DDL语句解析BUG (#3840) 2021-10-09 14:28:56 +08:00
ChenZhanggandChen Zhang eef3bd92ba Improve MAVEN build Performance (#3851)
Co-authored-by: Chen Zhang <340355960@qq.com>
2021-10-09 14:26:26 +08:00
agapple 474063af3b fixed issue #3494 , polardb-x 2.0 cdc support implicit_id/varaibles 2021-04-28 13:42:55 +08:00
agapple 5cc85ff2de [maven-release-plugin] prepare for next development iteration 2021-04-19 15:48:20 +08:00
agapple 64862503ba [maven-release-plugin] prepare release canal-1.1.5 2021-04-19 15:48:09 +08:00
agapple f9e0dc7daa fixed testcase 2021-04-19 15:15:10 +08:00
agapple 0c399509a9 upgrade druid 1.2.6 2021-04-19 12:57:21 +08:00
agapple a09cd9adb5 fixed issue #3110 , json escapse 2021-04-19 11:28:45 +08:00
agapple 1369418c6a fixed code format & merge 2021-04-19 10:55:43 +08:00
995586041 75174a63af 增加rabbitmq消息持久化deliveryMode配置 (#3300) 2021-04-19 10:29:23 +08:00
zoemak 17f4ee13e7 自动注册时可自定义node server名称,canal.properties#canal.admin.register.name,为空则使用canal.register.ip (#3459) 2021-04-19 10:18:01 +08:00
Fei Yang f0417502f8 fix: unit_present typo (#3461)
https://github.com/alibaba/canal/issues/3434
2021-04-19 10:16:17 +08:00
renyansongno1 a7720b51e4 支持rocketmq的消息按照tag去发送 (#3438)
* 支持rocketmq的消息按照tag去发送
并对应修改了配置文件

* 将tag的设计转移到Rocketmq的单独配置项
2021-04-19 10:14:27 +08:00
suman-lee 21904ef1dc 基于明确的I/U/D是否过滤 (#3452)
* dmls filter

* dmls filters

* 基于明确的I/U/D是否过滤

* 基于明确的I/U/D是否过滤
2021-04-19 10:10:54 +08:00
agapple 94425223bd fixed issue #3454 , concurrent env bugfix 2021-04-17 10:57:25 +08:00
agapple 7857df9701 add sql parser testcase 2021-04-17 10:49:17 +08:00
agapple 64ea4ff222 fixed issue #3267 , fixed rockemq send null message 2021-04-17 10:25:49 +08:00
agapple 85df89f777 fixed issue #3377 , escapse schema name 2021-04-16 23:11:41 +08:00
AlphaKitty a0f8e182ec 修复当host中存在冒号(比如https:)抛UnknownHostException问题 (#3223)
* 修复当host中存在冒号(比如https:)抛UnknownHostException问题

* 更优雅地解析url
2021-04-16 22:11:21 +08:00
温绍锦 33721d0394 update druid version (#3146)
* replace fastsql with druid

* update druid version
2021-04-16 22:09:40 +08:00
Treeyhandhai.yu 91bddfeed6 修复接入阿里云RocketMq no route info for this topic 问题 (#3220)
Co-authored-by: hai.yu <hai.yu@snowballtech.com>
2021-04-16 22:08:28 +08:00
16075140 25feab4af8 support rabbitmq port by config (#3236) 2021-04-16 22:07:12 +08:00
binbin f66baeabf1 修复最近位置被remove掉,导致重复消息的问题 (#3276) 2021-04-16 22:03:51 +08:00
agapple b1dc3821ea fixed config url auth 2021-04-16 21:52:23 +08:00
Jump-Boy f5f79104eb fix centos 6.10 yum bug and update jdk8.rpm download url (#3398) 2021-04-16 21:41:55 +08:00
ltamber e8d138d3bd fix: uuidset combine fix (#3432) 2021-04-16 21:37:55 +08:00
zoemak 32d9e58915 升级rocketmq到4.8.0,并且支持环境变量优先配置 (#3450) 2021-04-16 21:35:11 +08:00
许道杰 58448e559d fix: issue #2649 client-adapter启动时抛LinkageError异常、#3073 client-adapter通过启动参数传入canal.tcp.zookeeper.hosts为空值时抛异常 (#3074) 2021-04-16 21:25:14 +08:00
许道杰 fede3b3d1d fix #3126 将hbase-client依赖修改为hbase-shaded-client (#3127) 2021-04-16 21:24:44 +08:00
许道杰 5d8ec31bc4 fix #3119 (#3121) 2021-04-16 21:22:31 +08:00
WangCong 82b18ebe62 feat unsigned bug (#3104) 2021-04-16 21:17:43 +08:00
hupeng 66408782b0 process()方法中,在retry循环中处理成功应该break (#3080)
process()方法中,在retry循环中处理成功应该break
2021-04-16 21:14:43 +08:00
许道杰 846c8870ae fix: issue #3076 (#3077) 2021-04-16 21:12:12 +08:00
ljcoderandliguowang 8cfb07f07e 数据库名称如何存在中划线"-"情况下,SQL执行异常 (#3228)
Co-authored-by: liguowang <liguowang@aerozhonghaun.com>
2020-12-31 11:33:01 +08:00
文哥 d741425895 升级guava 至 22.0 (#3184)
* fix issue:#561 增加一个外部参数控制,允许位点不存在时自动重置到当前位点

* Add MariaDB GTID support

* remove client pom bad ns

* upgrade guava version to 22.0
2020-11-20 13:47:26 +08:00
文哥 20add85ff6 统一Canal 依赖的Spring 版本,升级ibatis 至mybatis (#3182)
* fix issue:#561 增加一个外部参数控制,允许位点不存在时自动重置到当前位点

* Add MariaDB GTID support

* 1. fix maven central repository url access error.(Update to https)
2. upgrade spring version to 5.0.5.RELEASE
3. upgrade ibatis to mybatis

* fix unit test run error
2020-11-20 09:24:56 +08:00
agapple a5c09c521e Update README.md 2020-11-02 12:54:54 +08:00
agapple c94276b1ac Update README.md 2020-11-02 12:53:35 +08:00
agapple 272d575c78 Update README.md 2020-11-02 12:44:59 +08:00
温绍锦 693f8d501a replace fastsql with druid (#3132) 2020-10-31 13:19:03 +08:00
温绍锦 bb1b6b9862 Update README.md 2020-10-23 14:41:31 +08:00
温绍锦 8ed82caaef Update README.md 2020-09-29 16:18:23 +08:00
文哥 de1dd70609 1. Add MariaDB gtid support 2. fix issue:#561 增加一个外部参数控制,允许位点不存在时自动重置到当前位点 (#3025)
* fix issue:#561 增加一个外部参数控制,允许位点不存在时自动重置到当前位点

* Add MariaDB GTID support
2020-09-24 17:56:40 +08:00
zavakid 09429c241f = inner class MessageEventFactory to be static 2020-09-23 11:37:17 +08:00
zavakid 9a332940d7 = remove unused import 2020-09-23 11:34:45 +08:00
zavakid 362974b1c2 = code cleanup: remove unnessary boxing 2020-09-18 00:54:23 +08:00
zavakid 435db30b7b = performance improve
- using bulk operation instead of iteration if possible
  - terminate loop after condition is met
2020-09-18 00:51:53 +08:00
zavakid e7de8289cd = code cleanup : modified inner class to 'static' if possible 2020-09-18 00:49:48 +08:00
zavakid 5065fea963 = fix BooleanMutex's inner Sync to static class and add test case 2020-09-18 00:44:25 +08:00
zavakid 6989eb3d2b + fix logging call placeholders number 2020-09-17 23:26:02 +08:00
zavakid df24596092 = code cleanup
- for loop replaceable with enhanced 'for' loop
  - using diamond in generic type
  - collapse try catch exception
  - using try-with-resource
  - using  List#sort instead of Collections#sort
  - replaced lambda with method reference
  - using native compare method to compare numbers
  - using switch instead of if for in ESSyncUtil
2020-09-17 23:22:25 +08:00
zavakid 43c23ffb97 = remove unused improt 2020-09-17 22:40:06 +08:00
zavakid e7658879bc = cold cleanup
* using lambda if possible (we are already building in Java8)
  * using diamond when new generic instance
  * remove used improt
2020-09-17 17:46:20 +08:00
zavakid df60eda679 = code cleanup 2020-09-16 14:18:05 +08:00
liguangyao b81e9dfeb8 支持不同topic指定专属partitionNum (#2479) 2020-08-22 13:11:53 +08:00
agapple b79af46054 merge code and fixed issue #2755 #2756 #2735 #2714 #2711 #2710 #2616 #2602 #2585 #2565 #2935 #2434 #2623 #2418 #2387 2020-08-22 13:07:24 +08:00
calvinhkf 90bf9e6de5 align h2 version to 1.4.196 (#2663) 2020-08-20 21:19:22 +08:00
zhaohua 182163c3bd MemoryTableMeta ddl 处理注释2 (#2694)
* MemoryTableMeta ddl 处理注释

* MemoryTableMeta ddl 处理注释2
2020-08-20 21:19:08 +08:00
dengliming e4726972de refactor: delete duplicate code (#2748) 2020-08-20 21:18:51 +08:00
dengliming 985892cf7e Remove deprecated sudo setting. (#2749) 2020-08-20 21:18:37 +08:00
chank 746d51e621 Change maven repository to HTTPS (#2763)
* change maven repository to https

* change maven repository to https
2020-08-20 21:18:25 +08:00
caoyixiong cdd077b758 FIX NPE When ddl event (#2801) 2020-08-20 21:18:12 +08:00
DinoZhang 72ae7ba8d7 meta admin (#2836) 2020-08-20 21:18:00 +08:00
Tocker b82c8bca83 Fix:Alibaba Coding Guidelines-Object的equals方法容易抛空指针异常,应使用常量或确定有值的对象来调用equals。 (#2919) 2020-08-20 21:17:44 +08:00
Tocker 576406a4ce Fix:Alibaba Coding Guidelines-所有的包装类对象之间值的比较,全部使用equals方法比较 (#2918) 2020-08-20 21:17:32 +08:00
Ymangz b5b08e92e3 Unbuntu 20.0 默认sh为dash执行时会报语法异常 (#2939) 2020-08-20 21:17:11 +08:00
wanshao 9f6021cf36 fix(dml): revert wrong fix 2020-03-13 17:41:53 +08:00
bucketli 0e3d719a39 refact(canal):duplicate dependence 2020-03-09 14:15:40 +08:00
agapple afbf125231 fixed format 2020-03-05 15:26:59 +08:00
agapple b2b2a82554 client-adapter 写入kudu (#2396)
* client-adapter 提交写入kudu适配器

* kudu etl 处理数据缓存提交问题

* Update KuduTemplate.java

* 1.写入kudu前获取元数据方式更改
2.解决etl批量导入kudu数据少量丢失问题

* 1.修改文件头注释
2.调整kudu更新事件update为upsert
2020-03-05 15:22:01 +08:00
wanshao 30a1b067a8 fix(project): no need to process tinyint(1) specially #631 2020-02-28 14:34:30 +08:00
wanshao beaca165d0 Merge branch 'master' of github.com:alibaba/canal 2020-02-28 14:24:33 +08:00
wanshao c21c18458b fix(project): fix isDdl judge #2599 2020-02-28 14:21:12 +08:00
agapple 5e761e14fa format 2020-02-28 13:15:27 +08:00
agapple 18418ebd98 merge pull/2120 2020-02-28 12:29:41 +08:00
844392610 92f04f86cb 添加目标表不区分大小写的支持,并可开关(默认为区分大小写) (#2329)
* 添加目标表不区分大小写的支持,并可开关(默认为区分大小写)

* 添加目标表不区分大小写的支持,并可开关(默认为区分大小写)-format
2020-02-28 12:22:17 +08:00
littleneko 0d5505aa2c fix_json_type_opaque_parse_err (#2318)
对于`JSONB_TYPE_OPAQUE`类型的解析计算`q_max_bytes`时,多算了`1`字节
2020-02-28 12:15:09 +08:00
zhshy11 bd56438eca sql语句增加引号,兼容mysql关键字 (#2358) 2020-02-28 11:47:38 +08:00
agapple b9a157657f merge /pull/2373 2020-02-28 11:46:28 +08:00
agapple 523e8b85e6 format 2020-02-28 11:40:14 +08:00
agapple ab74b2c82c fixed mq spi package 2020-02-28 11:32:30 +08:00
rewerma 265a8e8594 模块化mq connector (#2562)
* add connector module, add kafka producer connector module for server

* add rocketMQ producer connector module for server

* add rabbitMQ producer connector module for server

* optimize code, add annotation

* add canal message consumer connector for canal-adapter module
2020-02-28 11:00:08 +08:00
jianqingdu 4fc7e5f7d9 fix bug: wrong quit command implementation (#2554) 2020-02-28 10:52:35 +08:00
Li Qiang 9cc8caa834 feature(canal):support start with timestamp position(empty journal_file,set position=0),#2594 (#2595) 2020-02-28 10:50:38 +08:00
Li Qiang a71375dad5 fix(canal):fix endless local binlog mode with exception. (#2597) 2020-02-28 10:48:54 +08:00
Rg 70d8a379f2 add Rust canal client support (#2518) 2020-01-15 20:12:28 +08:00
rewerma b6333f018f Revert "修复kafka消费回滚的bug (#2521)" (#2526)
This reverts commit 31acfc0101.
2020-01-02 17:04:57 +08:00
rewerma 31acfc0101 修复kafka消费回滚的bug (#2521) 2020-01-02 16:15:47 +08:00
rewerma 6d9ea57186 修复子线程阻塞造成不能中止的问题 (#2508) 2019-12-26 19:29:48 +08:00
Li Qiang c4c0255073 Update README.md 2019-11-04 10:20:00 +08:00
agapple 1fa9020599 format 2019-10-15 21:38:48 +08:00
agapple dd7554374f format 2019-10-15 21:35:57 +08:00
shicongyang 65b5325ca6 建议增加一个属性,针对根据某一字段hash时,hash算法可以不根据database算出 #2248 (#2294) 2019-10-15 21:32:42 +08:00
agapple b64a3e301a fixed issue #2286 , ArithmeticException zero 2019-10-10 15:37:17 +08:00
agapple 31562919bb rename canal-admin project to admin 2019-10-09 14:50:08 +08:00
agapple 9c75e25da7 optimizer pom dependency 2019-10-09 14:18:37 +08:00
agapple 7d91850be6 fixed issue #2257 , time 100 parse bugfix 2019-10-09 13:39:22 +08:00
agapple 4af3b24b69 fixed issue #2281 , null reject 2019-10-08 18:50:37 +08:00
craigwu9 e4e66b143c make canal.admin.port canal.admin.user canal.admin.passwd can be override by system env properties (#2274)
* Update SimpleAdminConnectors.java

add more information about which server execute failed

* Update CanalStarter.java

make canal.admin.port canal.admin.user canal.admin.passwd can be override by system env
2019-09-30 20:45:00 +08:00
agapple dd93e2b0c4 fixed issue #2258 , optimizer rabbitmq send perf & matchTopics only match one Topic 2019-09-30 20:42:52 +08:00
agapple d505b5ab9d fixed issue #2258 , optimizer rocketmq send perf 2019-09-30 20:19:25 +08:00
agapple 0fb717a97f fixed issue #2258 , optimizer kafka send perf 2019-09-30 14:24:59 +08:00
一杯Hash c634f98fca bugfix mysql >= 8.0, 缓存层移除,EbeanServer 运行 Fail,Unknown system variable query_cache_size error! (#2264)
threw exception; nested exception is javax.persistence.PersistenceException: java.sql.SQLException: Unknown system variable 'query_cache_size'
2019-09-29 10:51:17 +08:00
rewerma 460479390a bug fix (#2249) 2019-09-26 10:58:28 +08:00
Li Qiang 26013e239d Update README.md 2019-09-25 19:49:22 +08:00
agapple 46fe40ed47 use es6x/es7x instead of elaticsearch project 2019-09-25 19:31:52 +08:00
Koshoooooo 0c27bcf73e Fix issue #2221 (#2242)
fastjson修复了拒绝服务安全问题,升级到当前1.2.58的兼容安全版本1.2.58.sec06
2019-09-25 19:28:13 +08:00
agapple d86b0e6e67 fixed testcase 2019-09-25 19:16:33 +08:00
EdgarScott fff623acb1 Add unit tests (#2235)
* Add Unit Tests for the following classes:

com.alibaba.otter.canal.client.adapter.support.JdbcTypeUtilTest
com.alibaba.otter.canal.client.adapter.support.UtilTest
com.taobao.tddl.dbsync.binlog.JsonConversion_Json_ValueTest
com.taobao.tddl.dbsync.binlog.JsonDiffConversionTest
com.taobao.tddl.dbsync.binlog.LogBufferTest
com.taobao.tddl.dbsync.binlog.LogEventTest
com.taobao.tddl.dbsync.binlog.event.LogHeaderTest
com.taobao.tddl.dbsync.binlog.event.RowsLogBufferTest
com.alibaba.otter.canal.parse.driver.mysql.packets.client.RegisterSlaveCommandPacketTest
com.alibaba.otter.canal.parse.driver.mysql.utils.ByteHelperTest
com.alibaba.otter.canal.parse.inbound.mysql.ddl.DdlResultTest
com.alibaba.otter.canal.parse.inbound.mysql.ddl.DruidDdlParserTest

These tests were written using Diffblue Cover

* Add dependencies and refactor
2019-09-25 18:53:24 +08:00
rewerma f45c0206da Add elasticsearch 7.x version adapter support (#2246)
* init es data sync upgrade

* Add elasticsearch 7.x version adapter support
2019-09-25 18:51:34 +08:00
gaecfov 61726c7e05 fix: ES配置文件监控问题 (#2202)
* fix:
ES监控配置文件时如果第一次因为文件错误新增失败后,再次修改不会新增的问题
ES监控配置文件添加的Config缓存没有带Instance导致匹配不到的问题

* fix:ES配置文件监控不生效
2019-09-17 09:22:55 +08:00
耐小心 79552e0a37 rabbitmq(amqp)MQ支持 (#2156) 2019-09-16 12:43:02 +08:00
agapple 5ec2087257 fixed issue #2197 , startup.bat fix 2019-09-16 09:58:27 +08:00
rewerma 5214257cd4 ES子表含group的where条件拼接 (#2190)
* ES子表含group的where条件拼接

* modify
2019-09-16 09:47:02 +08:00
gaecfov 365ca4d01f fix:当查询列包含常量拼接时解析主键字段进行条件拼接时会多出 where null=null (#2188) 2019-09-16 09:44:59 +08:00
agapple 419a73b3de fixed issue #2168, ignore create database 2019-09-12 09:08:30 +08:00
Jony c093fbb8f6 动态刷新同步锁状态 (#2181)
* 解决修改数据库远程配置,canal-adapter 一直循环destroy、init。

* 解决动态添加instance和对应的adapter无锁状态问题。
2019-09-12 08:52:33 +08:00
rewerma 31bb85bea3 fix bug #2023 and code optimize (#2167)
* 减少等待刷新状态时间

* fix bug #2023
2019-09-12 08:47:22 +08:00
rewerma 803565456f fix modified_time null value error (#2157)
* template config load

* compile vue frontend for product

* fix modified_time null value error

* modify
2019-09-07 21:53:11 +08:00
Li Qiang 520f5771d8 Update README.md 2019-09-06 15:02:34 +08:00
Li Qiang 5fbd6f6606 Update README.md 2019-09-06 14:57:47 +08:00
Li Qiang bc9c7f0f1d Update README.md 2019-09-06 14:54:22 +08:00
Li Qiang 08a2f0aa44 Update README.md 2019-09-06 14:45:33 +08:00
Li Qiang a0387faa67 Update README.md 2019-09-06 14:45:14 +08:00
Li Qiang 1dd4674ccb Update README.md 2019-09-06 13:36:04 +08:00
Jony 60e26d1ddd 解决修改数据库远程配置,canal-adapter 一直循环destroy、init。 (#2137) 2019-09-04 12:25:54 +08:00
agapple ecdab76705 fixed issue #2129 , Negative seek offset 2019-09-03 08:51:21 +08:00
agapple 403fdf997c Update README.md 2019-09-02 19:28:49 +08:00
agapple a9e83463e0 Update README.md 2019-09-02 19:27:50 +08:00
agapple 2bde4327c7 [maven-release-plugin] prepare for next development iteration 2019-09-02 14:24:16 +08:00
agapple d53bfd7ee7 [maven-release-plugin] prepare release canal-1.1.4 2019-09-02 14:24:03 +08:00
agapple ccc45b672c fixed issue #2127 , remove logback stdout 2019-09-02 14:10:29 +08:00
agapple 0d42bdafe2 fixed stdout 2019-09-02 14:04:19 +08:00
agapple 95050ff382 fixed test example 2019-09-02 13:46:35 +08:00
agapple 5addd246ac fixed unused error 2019-09-01 11:20:00 +08:00
agapple cfc95e2b7a fixed docker config 2019-09-01 10:41:00 +08:00
agapple 44187d9e3a fixed docker config 2019-09-01 10:15:58 +08:00
agapple c76e8ba0e4 fixed canal-admin 2019-08-31 15:23:58 +08:00
rewerma 1bcae9dc49 template config load (#2123)
* template config load

* compile vue frontend for product
2019-08-31 14:56:28 +08:00
agapple 3a388308d9 fixed compiler error 2019-08-31 13:01:52 +08:00
agapple a60ec6fa42 fixed tescase failed 2019-08-31 13:00:31 +08:00
agapple 456945fe3a add autoRegister and cluster 2019-08-31 12:59:12 +08:00
agapple ba24c15833 add conflict file 2019-08-31 12:47:27 +08:00
agapple 4e0b8a0278 fixed admin 2019-08-31 12:24:41 +08:00
rewerma 274e91f8aa bug fix (#2122)
* admin端口调整完成

* server端适配调整

* 调整部分功能

* 单机/集群admin调试完成

* 重新发布前端页面

* bug fix

* 解决server端admin配置会被远程覆盖的问题
解决default-instance.xml无法加载远程zkServers配置的问题

* 集群模式下取活动实例的问题
2019-08-31 12:22:16 +08:00
rewerma 89055f7405 canal-admin完善 (#2121)
* admin端口调整完成

* server端适配调整

* 调整部分功能

* 单机/集群admin调试完成

* 重新发布前端页面
2019-08-30 18:09:22 +08:00
rewerma e8dba41216 code optimize (#2108)
* code optimize
2019-08-27 22:52:14 +08:00
agapple f52b2cccd5 fixed testcase 2019-08-27 22:45:27 +08:00
rewerma 7386327af9 code optimize (#2107)
* admin assembly打包

* 修改npm  profile

* code optimize

* code optimize
2019-08-27 22:24:53 +08:00
rewerma c48407b449 修改npm profile (#2106)
* admin assembly打包

* 修改npm  profile
2019-08-27 20:55:15 +08:00
rewerma d92badeb45 admin assembly打包 (#2104) 2019-08-27 19:48:22 +08:00
agapple 7093179cc8 fixed issue #2099 , rename poll to polling 2019-08-27 16:25:42 +08:00
agapple bf89974f7c fixed issue #2099 , support remote config poll 2019-08-27 16:11:20 +08:00
rewerma 2e1b7a5093 通过http从canal-admin中拉配置 (#2093)
* modify

* http拉取配置监听

* revert main pom

* 整理代码
2019-08-26 19:01:08 +08:00
agapple 3d4dbc9a8c fixed issue #2099 , support user/passwd acl and canal admin operator 2019-08-26 18:16:33 +08:00
agapple e376a129ed fixed canal-admin vue 2019-08-24 16:54:27 +08:00
wangwengeek 983ff5fc73 查询数据过长变成byte数组转化为json解决 (#2090)
Caused by: com.alibaba.fastjson.JSONException: syntax error, pos 2, json : [B@406b7f2 #2089
2019-08-23 17:38:22 +08:00
737 changed files with 37502 additions and 25661 deletions
+5 -4
View File
@@ -18,7 +18,8 @@ jtester.properties
*.rpm
client-adapter/example/
*.dat
canal-admin/canal-admin-ui/dist
canal-admin/canal-admin-ui/node
canal-admin/canal-admin-ui/node_modules
conf/
canal-admin/canal-admin-ui/dist/
canal-admin/canal-admin-ui/node/
canal-admin/canal-admin-ui/node_modules/
canal-admin/canal-admin-server/src/main/resources/conf/
+1 -1
View File
@@ -14,7 +14,7 @@ cache:
install: true
script:
- travis_wait 30 ./mvnw clean install -DskipTests=false -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true
- travis_wait 30 ./mvnw -T 1C clean install -DskipTests=false -Dcheckstyle.skip=true -Dmaven.javadoc.skip=true
after_success:
- bash <(curl -s https://codecov.io/bash)
+19 -17
View File
@@ -5,11 +5,13 @@
[![average time to resolve an issue](http://isitmaintained.com/badge/resolution/alibaba/canal.svg)](http://isitmaintained.com/project/alibaba/canal "average time to resolve an issue")
[![percentage of issues still open](http://isitmaintained.com/badge/open/alibaba/canal.svg)](http://isitmaintained.com/project/alibaba/canal "percentage of issues still open")
## 背景
## 简介
早期,阿里巴巴 B2B 公司因为存在杭州和美国双机房部署,存在跨机房同步的业务需求 ,主要是基于trigger的方式获取增量变更。从 2010 年开始,公司开始逐步尝试数据库日志解析,获取增量变更进行同步,由此衍生出了增量订阅和消费业务,从此开启一段新纪元。
![](https://img-blog.csdnimg.cn/20191104101735947.png)
当前的 canal 支持源端 MySQL 版本包括 5.1.x , 5.5.x , 5.6.x , 5.7.x , 8.0.x
**canal [kə'næl]**,译意为水道/管道/沟渠,主要用途是基于 MySQL 数据库增量日志解析,提供增量数据订阅和消费
早期阿里巴巴因为杭州和美国双机房部署,存在跨机房同步的业务需求,实现方式主要是基于业务 trigger 获取增量变更。从 2010 年开始,业务逐步尝试数据库日志解析获取增量变更进行同步,由此衍生出了大量的数据库增量订阅和消费业务。
基于日志增量订阅和消费的业务包括
- 数据库镜像
@@ -18,12 +20,7 @@
- 业务 cache 刷新
- 带业务逻辑的增量数据处理
## 项目介绍
#### 名称:canal [kə'næl]
#### 译意: 水道/管道/沟渠
#### 产品定位: 基于数据库增量日志解析,提供增量数据订阅和消费
#### 关键词: MySQL binlog parser / real-time / queue&topic / index build
当前的 canal 支持源端 MySQL 版本包括 5.1.x , 5.5.x , 5.6.x , 5.7.x , 8.0.x
## 工作原理
@@ -35,7 +32,6 @@
- MySQL slave 重放 relay log 中事件,将数据变更反映它自己的数据
#### canal 工作原理
![](http://dl.iteye.com/upload/attachment/0080/3107/c87b67ba-394c-3086-9577-9db05be04c95.jpg)
- canal 模拟 MySQL slave 的交互协议,伪装自己为 MySQL slave ,向 MySQL master 发送dump 协议
- MySQL master 收到 dump 请求,开始推送 binary log 给 slave (即 canal )
@@ -43,7 +39,7 @@
## 重要版本更新说明
canal 1.1.x 版本([release_note](https://github.com/alibaba/canal/releases)),性能与功能层面有较大的突破,重要提升包括:
1. canal 1.1.x 版本([release_note](https://github.com/alibaba/canal/releases)),性能与功能层面有较大的突破,重要提升包括:
- 整体性能测试&优化,提升了150%. #726 参考: [Performance](https://github.com/alibaba/canal/wiki/Performance)
- 原生支持prometheus监控 #765 [Prometheus QuickStart](https://github.com/alibaba/canal/wiki/Prometheus-QuickStart)
@@ -51,6 +47,8 @@ canal 1.1.x 版本([release_note](https://github.com/alibaba/canal/releases)
- 原生支持aliyun rds的binlog订阅 (解决自动主备切换/oss binlog离线解析) 参考: [Aliyun RDS QuickStart](https://github.com/alibaba/canal/wiki/aliyun-RDS-QuickStart)
- 原生支持docker镜像 #801 参考: [Docker QuickStart](https://github.com/alibaba/canal/wiki/Docker-QuickStart)
2. canal 1.1.4版本,迎来最重要的WebUI能力,引入canal-admin工程,支持面向WebUI的canal动态管理能力,支持配置、任务、日志等在线白屏运维能力,具体文档:[Canal Admin Guide](https://github.com/alibaba/canal/wiki/Canal-Admin-Guide)
## 文档
- [Home](https://github.com/alibaba/canal/wiki/Home)
@@ -60,6 +58,11 @@ canal 1.1.x 版本([release_note](https://github.com/alibaba/canal/releases)
- [Canal Kafka/RocketMQ QuickStart](https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart")
- [Aliyun RDS for MySQL QuickStart](https://github.com/alibaba/canal/wiki/aliyun-RDS-QuickStart)
- [Prometheus QuickStart](https://github.com/alibaba/canal/wiki/Prometheus-QuickStart)
- Canal Admin
- [Canal Admin QuickStart](https://github.com/alibaba/canal/wiki/Canal-Admin-QuickStart)
- [Canal Admin Guide](https://github.com/alibaba/canal/wiki/Canal-Admin-Guide)
- [Canal Admin ServerGuide](https://github.com/alibaba/canal/wiki/Canal-Admin-ServerGuide)
- [Canal Admin Docker](https://github.com/alibaba/canal/wiki/Canal-Admin-Docker)
- [AdminGuide](https://github.com/alibaba/canal/wiki/AdminGuide)
- [ClientExample](https://github.com/alibaba/canal/wiki/ClientExample)
- [ClientAPI](https://github.com/alibaba/canal/wiki/ClientAPI)
@@ -81,20 +84,19 @@ canal 特别设计了 client-server 模式,交互协议使用 protobuf 3.0 , c
- canal go客户端: [https://github.com/CanalClient/canal-go](https://github.com/CanalClient/canal-go)
- canal php客户端: [https://github.com/xingwenge/canal-php](https://github.com/xingwenge/canal-php)
- canal Python客户端:[https://github.com/haozi3156666/canal-python](https://github.com/haozi3156666/canal-python)
- canal Rust客户端:[https://github.com/laohanlinux/canal-rs](https://github.com/laohanlinux/canal-rs)
canal 作为 MySQL binlog 增量获取和解析工具,可将变更记录投递到 MQ 系统中,比如 Kafka/RocketMQ,可以借助于 MQ 的多语言能力
- 参考文档: [Canal Kafka/RocketMQ QuickStart](https://github.com/alibaba/canal/wiki/Canal-Kafka-RocketMQ-QuickStart)
## 相关开源
## 相关开源&产品
- [canal 消费端开源项目: Otter](http://github.com/alibaba/otter)
- [阿里巴巴去 Oracle 数据迁移同步工具: yugong](http://github.com/alibaba/yugong)
- [阿里巴巴离线同步开源项目 DataX](https://github.com/alibaba/datax)
- [阿里巴巴数据库连接池开源项目 Druid](https://github.com/alibaba/druid)
- [阿里巴巴实时数据同步工具 DTS](https://www.aliyun.com/product/dts)
## 问题反馈
- 邮件: jianghang115@gmail.com
- 报告 issue: [github issues](https://github.com/alibaba/canal/issues)
## 其他资料
- [ ADC 阿里技术嘉年华分享 ppt ( google docs)](https://docs.google.com/presentation/d/1MkszUPYRDkfVPz9IqOT1LLT5d9tuwde_WC8GZvjaDRg/edit?usp=sharing)
BIN
View File
Binary file not shown.
@@ -1,16 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>canal-admin</artifactId>
<artifactId>canal.admin</artifactId>
<groupId>com.alibaba.otter</groupId>
<version>1.1.4-SNAPSHOT</version>
<version>1.1.7-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>canal-admin-ui</artifactId>
<artifactId>canal.admin-ui</artifactId>
<name>canal admin-ui module for otter ${project.version}</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
@@ -20,11 +18,11 @@
<profiles>
<profile>
<id>release</id>
<id>npm</id>
<activation>
<property>
<name>env</name>
<value>release</value>
<value>npm</value>
</property>
</activation>
<build>

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.2 KiB

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

+46
View File
@@ -0,0 +1,46 @@
import request from '@/utils/request'
export function getCanalClusters(params) {
return request({
url: '/canal/clusters',
method: 'get',
params: params
})
}
export function addCanalCluster(data) {
return request({
url: '/canal/cluster',
method: 'post',
data
})
}
export function canalClusterDetail(id) {
return request({
url: '/canal/cluster/' + id,
method: 'get'
})
}
export function updateCanalCluster(data) {
return request({
url: '/canal/cluster',
method: 'put',
data
})
}
export function deleteCanalCluster(id) {
return request({
url: '/canal/cluster/' + id,
method: 'delete'
})
}
export function getClustersAndServers() {
return request({
url: '/canal/clustersAndServers',
method: 'get'
})
}
+23
View File
@@ -0,0 +1,23 @@
import request from '@/utils/request'
export function getCanalConfig(clusterId, serverId) {
return request({
url: '/canal/config/' + clusterId + '/' + serverId,
method: 'get'
})
}
export function updateCanalConfig(data) {
return request({
url: '/canal/config',
method: 'put',
data
})
}
export function getTemplateConfig() {
return request({
url: '/canal/config/template',
method: 'get'
})
}
@@ -58,3 +58,24 @@ export function instanceLog(id, nodeId) {
method: 'get'
})
}
export function instanceStatus(id, option) {
return request({
url: '/canal/instance/status/' + id + '?option=' + option,
method: 'put'
})
}
export function getActiveInstances(serverId) {
return request({
url: '/canal/active/instances/' + serverId,
method: 'get'
})
}
export function getTemplateInstance() {
return request({
url: '/canal/instance/template',
method: 'get'
})
}

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 4.7 KiB

@@ -0,0 +1,101 @@
<template>
<div :class="{'hidden':hidden}" class="pagination-container">
<el-pagination
:background="background"
:current-page.sync="currentPage"
:page-size.sync="pageSize"
:layout="layout"
:page-sizes="pageSizes"
:total="total"
v-bind="$attrs"
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
/>
</div>
</template>
<script>
import { scrollTo } from '@/utils/scrollTo'
export default {
name: 'Pagination',
props: {
total: {
required: true,
type: Number
},
page: {
type: Number,
default: 1
},
limit: {
type: Number,
default: 20
},
pageSizes: {
type: Array,
default() {
return [10, 20, 30, 50]
}
},
layout: {
type: String,
default: 'total, sizes, prev, pager, next, jumper'
},
background: {
type: Boolean,
default: true
},
autoScroll: {
type: Boolean,
default: true
},
hidden: {
type: Boolean,
default: false
}
},
computed: {
currentPage: {
get() {
return this.page
},
set(val) {
this.$emit('update:page', val)
}
},
pageSize: {
get() {
return this.limit
},
set(val) {
this.$emit('update:limit', val)
}
}
},
methods: {
handleSizeChange(val) {
this.$emit('pagination', { page: this.currentPage, limit: val })
if (this.autoScroll) {
scrollTo(0, 800)
}
},
handleCurrentChange(val) {
this.$emit('pagination', { page: val, limit: this.pageSize })
if (this.autoScroll) {
scrollTo(0, 800)
}
}
}
}
</script>
<style scoped>
.pagination-container {
background: #fff;
padding: 32px 16px;
}
.pagination-container.hidden {
display: none;
}
</style>

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

Before

Width:  |  Height:  |  Size: 497 B

After

Width:  |  Height:  |  Size: 497 B

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before

Width:  |  Height:  |  Size: 944 B

After

Width:  |  Height:  |  Size: 944 B

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Before

Width:  |  Height:  |  Size: 285 B

After

Width:  |  Height:  |  Size: 285 B

Before

Width:  |  Height:  |  Size: 821 B

After

Width:  |  Height:  |  Size: 821 B

Before

Width:  |  Height:  |  Size: 623 B

After

Width:  |  Height:  |  Size: 623 B

Before

Width:  |  Height:  |  Size: 597 B

After

Width:  |  Height:  |  Size: 597 B

Before

Width:  |  Height:  |  Size: 1.8 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

@@ -77,49 +77,56 @@ export const constantRoutes = [
meta: { title: 'Canal Server', icon: 'example' },
children: [
{
path: 'nodeServers',
name: '节点状态',
component: () => import('@/views/canalServer/NodeServer'),
meta: { title: '节点管理', icon: 'tree' }
path: 'canalClusters',
name: 'Canal 集群管理',
component: () => import('@/views/canalServer/CanalCluster'),
meta: { title: '集群管理', icon: 'tree' }
},
{
path: 'config',
name: 'Canal主配置',
component: () => import('@/views/canalServer/Config'),
meta: { title: 'Canal主配置', icon: 'form' }
path: 'nodeServers',
name: 'Server 状态',
component: () => import('@/views/canalServer/NodeServer'),
meta: { title: 'Server 管理', icon: 'form' }
},
{
path: 'nodeServer/config',
name: 'Server 配置',
component: () => import('@/views/canalServer/CanalConfig'),
meta: { title: 'Server 配置' },
hidden: true
},
{
path: 'canalInstances',
name: '实例管理',
name: 'Instance 管理',
component: () => import('@/views/canalServer/CanalInstance'),
meta: { title: '实例管理', icon: 'nested' }
meta: { title: 'Instance 管理', icon: 'nested' }
},
{
path: 'canalInstance/add',
name: '新建实例配置',
name: '新建Instance配置',
component: () => import('@/views/canalServer/CanalInstanceAdd'),
meta: { title: '新建实例配置' },
meta: { title: '新建Instance配置' },
hidden: true
},
{
path: 'canalInstance/modify',
name: '修改实例配置',
name: '修改Instance配置',
component: () => import('@/views/canalServer/CanalInstanceUpdate'),
meta: { title: '修改实例配置' },
meta: { title: '修改Instance配置' },
hidden: true
},
{
path: 'nodeServer/log',
name: 'Canal日志',
name: 'Server 日志',
component: () => import('@/views/canalServer/CanalLogDetail'),
meta: { title: 'Canal日志' },
meta: { title: 'Server 日志' },
hidden: true
},
{
path: 'canalInstance/log',
name: 'Canal Instance日志',
name: 'Instance 日志',
component: () => import('@/views/canalServer/CanalInstanceLogDetail'),
meta: { title: 'Canal Instance日志' },
meta: { title: 'Instance 日志' },
hidden: true
}
]
+50
View File
@@ -0,0 +1,50 @@
Math.easeInOutQuad = function(t, b, c, d) {
t /= d / 2
if (t < 1) {
return c / 2 * t * t + b
}
t--
return -c / 2 * (t * (t - 2) - 1) + b
}
// requestAnimationFrame for Smart Animating http://goo.gl/sx5sts
var requestAnimFrame = (function() {
return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || function(callback) { window.setTimeout(callback, 1000 / 60) }
})()
// because it's so fucking difficult to detect the scrolling element, just move them all
function move(amount) {
document.documentElement.scrollTop = amount
document.body.parentNode.scrollTop = amount
document.body.scrollTop = amount
}
function position() {
return document.documentElement.scrollTop || document.body.parentNode.scrollTop || document.body.scrollTop
}
export function scrollTo(to, duration, callback) {
const start = position()
const change = to - start
const increment = 20
let currentTime = 0
duration = (typeof (duration) === 'undefined') ? 500 : duration
var animateScroll = function() {
// increment the time
currentTime += increment
// find the value with the quadratic in-out easing function
var val = Math.easeInOutQuad(currentTime, start, change, duration)
// move the document.body
move(val)
// do the animation unless its over
if (currentTime < duration) {
requestAnimFrame(animateScroll)
} else {
if (callback && typeof (callback) === 'function') {
// the animation is done so lets callback
callback()
}
}
}
animateScroll()
}
@@ -0,0 +1,204 @@
<template>
<div class="app-container">
<div class="filter-container">
<!-- <el-input v-model="listQuery.name" placeholder="Server 名称" style="width: 200px;" class="filter-item" />
<el-input v-model="listQuery.ip" placeholder="Server IP" style="width: 200px;" class="filter-item" />
<el-button class="filter-item" type="primary" icon="el-icon-search" plain @click="fetchData()">查询</el-button> -->
<el-button class="filter-item" type="primary" @click="handleCreate()">新建集群</el-button>
</div>
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
highlight-current-row
>
<el-table-column label="集群名称" min-width="200" align="center">
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column label="ZK地址" min-width="300" align="center">
<template slot-scope="scope">
<span>{{ scope.row.zkHosts }}</span>
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="操作" min-width="150">
<template slot-scope="scope">
<el-dropdown trigger="click">
<el-button type="primary" size="mini">
操作<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleConfig(scope.row)">主配置</el-dropdown-item>
<el-dropdown-item @click.native="handleUpdate(scope.row)">修改集群</el-dropdown-item>
<el-dropdown-item @click.native="handleDelete(scope.row)">删除集群</el-dropdown-item>
<el-dropdown-item @click.native="handleView(scope.row)">查看Server</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<el-dialog :visible.sync="dialogFormVisible" :title="textMap[dialogStatus]" width="600px">
<el-form ref="dataForm" :rules="rules" :model="canalCluster" label-position="left" label-width="120px" style="width: 400px; margin-left:30px;">
<el-form-item label="集群名称" prop="name">
<el-input v-model="canalCluster.name" />
</el-form-item>
<el-form-item label="ZK地址" prop="zkHosts">
<el-input v-model="canalCluster.zkHosts" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="dataOperation()">确定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { addCanalCluster, getCanalClusters, updateCanalCluster, deleteCanalCluster } from '@/api/canalCluster'
export default {
filters: {
statusFilter(status) {
const statusMap = {
'1': 'success',
'0': 'gray',
'-1': 'danger'
}
return statusMap[status]
},
statusLabel(status) {
const statusMap = {
'1': '启动',
'0': '停止',
'-1': '断开'
}
return statusMap[status]
}
},
data() {
return {
list: null,
listLoading: true,
listQuery: {
name: '',
ip: ''
},
dialogFormVisible: false,
textMap: {
create: '新建集群信息',
update: '修改集群信息'
},
canalCluster: {
id: null,
name: null,
zkHosts: null
},
rules: {
name: [{ required: true, message: '集群名称不能为空', trigger: 'change' }],
zkHosts: [{ required: true, message: 'zk地址不能为空', trigger: 'change' }]
},
dialogStatus: 'create'
}
},
created() {
this.fetchData()
},
methods: {
fetchData() {
this.listLoading = true
getCanalClusters(this.listQuery).then(res => {
this.list = res.data
}).finally(() => {
this.listLoading = false
})
},
resetModel() {
this.canalCluster = {
id: null,
name: null,
zkHosts: null
}
},
handleCreate() {
this.resetModel()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
dataOperation() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
if (this.dialogStatus === 'create') {
addCanalCluster(this.canalCluster).then(res => {
this.operationRes(res)
})
}
if (this.dialogStatus === 'update') {
updateCanalCluster(this.canalCluster).then(res => {
this.operationRes(res)
})
}
}
})
},
operationRes(res) {
if (res.data === 'success') {
this.fetchData()
this.dialogFormVisible = false
this.$message({
message: this.textMap[this.dialogStatus] + '成功',
type: 'success'
})
} else {
this.$message({
message: this.textMap[this.dialogStatus] + '失败',
type: 'error'
})
}
},
handleView(row) {
this.$router.push('/canalServer/nodeServers?clusterId=' + row.id)
},
handleConfig(row) {
this.$router.push('/canalServer/nodeServer/config?clusterId=' + row.id)
},
handleUpdate(row) {
this.resetModel()
this.canalCluster = Object.assign({}, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
handleDelete(row) {
this.$confirm('删除集群信息会导致服务停止', '确定删除集群信息', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCanalCluster(row.id).then((res) => {
if (res.data === 'success') {
this.fetchData()
this.$message({
message: '删除集群信息成功',
type: 'success'
})
} else {
this.$message({
message: '删除集群信息失败',
type: 'error'
})
}
})
})
}
}
}
</script>
@@ -4,8 +4,10 @@
<div style="padding-left: 10px;padding-top: 20px;">
<el-form-item>
{{ form.name }}&nbsp;&nbsp;&nbsp;&nbsp;
<el-button type="primary" @click="onSubmit">修改</el-button>
<el-button type="primary" @click="onSubmit">保存</el-button>
<el-button type="warning" @click="onCancel">重置</el-button>
<el-button type="success" @click="onLoadTemplate">载入模板</el-button>
<el-button type="info" @click="onBack">返回</el-button>
</el-form-item>
</div>
<editor v-model="form.content" lang="properties" theme="chrome" width="100%" :height="800" @init="editorInit" />
@@ -14,7 +16,7 @@
</template>
<script>
import { getCanalConfig, updateCanalConfig } from '@/api/canalConfig'
import { getCanalConfig, updateCanalConfig, getTemplateConfig } from '@/api/canalConfig'
export default {
components: {
@@ -25,7 +27,9 @@ export default {
form: {
id: null,
name: '',
content: ''
content: '',
serverId: null,
clusterId: null
}
}
},
@@ -44,16 +48,32 @@ export default {
require('brace/snippets/javascript')
},
loadCanalConfig() {
getCanalConfig().then(response => {
let clusterId = 0
let serverId = 0
if (this.$route.query.clusterId) {
clusterId = this.$route.query.clusterId
} else if (this.$route.query.serverId) {
serverId = this.$route.query.serverId
}
getCanalConfig(clusterId, serverId).then(response => {
const data = response.data
this.form.id = data.id
this.form.name = data.name
this.form.content = data.content
this.form.serverId = this.$route.query.serverId
this.form.clusterId = this.$route.query.clusterId
})
},
onSubmit() {
if (this.form.content === null || this.form.content === '') {
this.$message({
message: '配置内容不能为空',
type: 'error'
})
return
}
this.$confirm(
'修改Canal主配置可能会导致Server重启,是否继续?',
'修改主配置可能会导致Server重启,是否继续?',
'确定修改',
{
confirmButtonText: '确定',
@@ -64,13 +84,13 @@ export default {
updateCanalConfig(this.form).then(response => {
if (response.data === 'success') {
this.$message({
message: '修改成功',
message: '保存成功',
type: 'success'
})
this.loadCanalConfig()
} else {
this.$message({
message: '修改失败',
message: '保存失败',
type: 'error'
})
}
@@ -79,6 +99,14 @@ export default {
},
onCancel() {
this.loadCanalConfig()
},
onBack() {
history.go(-1)
},
onLoadTemplate() {
getTemplateConfig().then(res => {
this.form.content = res.data
})
}
}
}
@@ -0,0 +1,228 @@
<template>
<div class="app-container">
<div class="filter-container">
<el-input v-model="listQuery.name" placeholder="Instance 名称" style="width: 200px;" class="filter-item" />
<el-select v-model="listQuery.clusterServerId" placeholder="所属集群/主机" class="filter-item">
<el-option key="" label="所属集群/主机" value="" />
<el-option-group v-for="group in options" :key="group.label" :label="group.label">
<el-option v-for="item in group.options" :key="item.value" :label="item.label" :value="item.value" />
</el-option-group>
</el-select>
<el-button class="filter-item" type="primary" icon="el-icon-search" plain @click="queryData()">查询</el-button>
&nbsp;&nbsp;
<el-button class="filter-item" type="primary" @click="handleCreate()">新建 Instance</el-button>
<el-button class="filter-item" type="info" @click="fetchData()">刷新列表</el-button>
</div>
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
highlight-current-row
>
<el-table-column label="Instance 名称" min-width="200" align="center">
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column label="所属集群" min-width="200" align="center">
<template slot-scope="scope">
<span v-if="scope.row.canalCluster !== null">
{{ scope.row.canalCluster.name }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column label="所属主机" min-width="200" align="center">
<template slot-scope="scope">
<span v-if="scope.row.nodeServer !== null">
{{ scope.row.nodeServer.name }}
</span>
<span v-else>-</span>
</template>
</el-table-column>
<el-table-column class-name="status-col" label="状态" min-width="150" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.runningStatus | statusFilter">{{ scope.row.runningStatus | statusLabel }}</el-tag>
</template>
</el-table-column>
<el-table-column label="修改时间" min-width="200" align="center">
<template slot-scope="scope">
{{ scope.row.modifiedTime }}
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="操作" min-width="150">
<template slot-scope="scope">
<el-dropdown trigger="click">
<el-button type="primary" size="mini">
操作<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleUpdate(scope.row)">修改</el-dropdown-item>
<el-dropdown-item @click.native="handleDelete(scope.row)">删除</el-dropdown-item>
<el-dropdown-item @click.native="handleStart(scope.row)">启动</el-dropdown-item>
<el-dropdown-item @click.native="handleStop(scope.row)">停止</el-dropdown-item>
<el-dropdown-item @click.native="handleLog(scope.row)">日志</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<pagination v-show="count>0" :total="count" :page.sync="listQuery.page" :limit.sync="listQuery.size" @pagination="fetchData()" />
</div>
</template>
<script>
import { getCanalInstances, deleteCanalInstance, instanceStatus } from '@/api/canalInstance'
import Pagination from '@/components/Pagination'
import { getClustersAndServers } from '@/api/canalCluster'
export default {
components: { Pagination },
filters: {
statusFilter(status) {
const statusMap = {
'1': 'success',
'0': 'gray'
}
return statusMap[status]
},
statusLabel(status) {
const statusMap = {
'1': '启动',
'0': '停止'
}
return statusMap[status]
}
},
data() {
return {
list: null,
listLoading: true,
dialogFormVisible: false,
nodeServices: [],
count: 0,
options: [],
listQuery: {
name: '',
clusterServerId: '',
page: 1,
size: 20
},
currentId: null,
rules: {
id: [{ required: true, message: '请选择运行Server', trigger: 'change' }]
}
}
},
created() {
getClustersAndServers().then((res) => {
this.options = res.data
})
this.fetchData()
},
methods: {
queryData() {
this.listQuery.page = 1
this.fetchData()
},
fetchData() {
this.listLoading = true
getCanalInstances(this.listQuery).then(res => {
this.list = res.data.items
this.count = res.data.count
}).finally(() => {
this.listLoading = false
})
},
handleCreate() {
this.$router.push('/canalServer/canalInstance/add')
},
handleUpdate(row) {
this.$router.push('/canalServer/canalInstance/modify?id=' + row.id)
},
handleDelete(row) {
this.$confirm('删除Instance配置会导致停止', '确定删除Instance信息', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteCanalInstance(row.id).then((res) => {
if (res.data === 'success') {
this.fetchData()
this.$message({
message: '删除Instance信息成功',
type: 'success'
})
} else {
this.$message({
message: '删除Instance信息失败',
type: 'error'
})
}
})
})
},
handleStart(row) {
// if (row.runningStatus === '1') {
// this.$message({ message: '当前Instance已处于启动状态!', type: 'error' })
// return
// }
this.$confirm('启动Instance: ' + row.name, '确定启动Instance服务', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
instanceStatus(row.id, 'start').then((res) => {
if (res.data) {
this.fetchData()
this.$message({
message: '启动成功, 稍后请刷新列表查看状态',
type: 'success'
})
} else {
this.$message({
message: '启动Instance出现异常',
type: 'error'
})
}
})
})
},
handleStop(row) {
// if (row.runningStatus === '0') {
// this.$message({ message: '当前Instance已处于停止状态!', type: 'error' })
// return
// }
this.$confirm('停止Instance: ' + row.name, '确定停止Instance服务', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
instanceStatus(row.id, 'stop').then((res) => {
if (res.data) {
this.fetchData()
this.$message({
message: '停止成功, 稍后请刷新列表查看状态',
type: 'success'
})
} else {
this.$message({
message: '停止Instance出现异常',
type: 'error'
})
}
})
})
},
handleLog(row) {
if (row.nodeId === null) {
this.$message({ message: '当前Instance不是启动状态,无法查看日志', type: 'warning' })
return
}
this.$router.push('canalInstance/log?id=' + row.id + '&nodeId=' + row.nodeServer.id)
}
}
}
</script>
@@ -2,9 +2,14 @@
<div>
<el-form ref="form" :model="form">
<div class="filter-container" style="padding-left: 10px;padding-top: 20px;">
<el-input v-model="form.name" placeholder="实例名称" style="width: 200px;" class="filter-item" />
&nbsp;
<el-button class="filter-item" type="primary" @click="onSubmit">新建</el-button>
<el-input v-model="form.name" placeholder="Instance名称" style="width: 200px;" class="filter-item" />
<el-select v-model="form.clusterServerId" placeholder="所属集群/主机" class="filter-item">
<el-option-group v-for="group in options" :key="group.label" :label="group.label">
<el-option v-for="item in group.options" :key="item.value" :label="item.label" :value="item.value" />
</el-option-group>
</el-select>
<el-button class="filter-item" type="primary" @click="onSubmit">保存</el-button>
<el-button class="filter-item" type="success" @click="onLoadTemplate">载入模板</el-button>
<el-button class="filter-item" type="info" @click="onBack">返回</el-button>
</div>
<editor v-model="form.content" lang="properties" theme="chrome" width="100%" :height="800" @init="editorInit" />
@@ -13,7 +18,8 @@
</template>
<script>
import { addCanalInstance } from '@/api/canalInstance'
import { addCanalInstance, getTemplateInstance } from '@/api/canalInstance'
import { getClustersAndServers } from '@/api/canalCluster'
export default {
components: {
@@ -21,13 +27,18 @@ export default {
},
data() {
return {
options: [],
form: {
name: '',
content: ''
content: '',
clusterServerId: ''
}
}
},
created() {
getClustersAndServers().then((res) => {
this.options = res.data
})
},
methods: {
editorInit() {
@@ -43,7 +54,21 @@ export default {
onSubmit() {
if (this.form.name === '') {
this.$message({
message: '请输入实例名称',
message: '请输入Instance名称',
type: 'error'
})
return
}
if (this.form.clusterServerId === '') {
this.$message({
message: '请选择所属集群/主机',
type: 'error'
})
return
}
if (this.form.content === null || this.form.content === '') {
this.$message({
message: '请输入配置内容',
type: 'error'
})
return
@@ -75,6 +100,11 @@ export default {
},
onBack() {
history.go(-1)
},
onLoadTemplate() {
getTemplateInstance().then(res => {
this.form.content = res.data
})
}
}
}
@@ -4,6 +4,11 @@
<div style="padding-left: 10px;padding-top: 20px;">
<el-form-item>
{{ form.name }}&nbsp;&nbsp;&nbsp;&nbsp;
<el-select v-model="form.clusterServerId" placeholder="所属集群/主机" class="filter-item">
<el-option-group v-for="group in options" :key="group.label" :label="group.label">
<el-option v-for="item in group.options" :key="item.value" :label="item.label" :value="item.value" />
</el-option-group>
</el-select>
<el-button type="primary" @click="onSubmit">修改</el-button>
<el-button type="warning" @click="onCancel">重置</el-button>
<el-button type="info" @click="onBack">返回</el-button>
@@ -16,6 +21,7 @@
<script>
import { canalInstanceDetail, updateCanalInstance } from '@/api/canalInstance'
import { getClustersAndServers } from '@/api/canalCluster'
export default {
components: {
@@ -23,15 +29,20 @@ export default {
},
data() {
return {
options: [],
form: {
id: null,
name: '',
content: ''
content: '',
clusterServerId: ''
}
}
},
created() {
this.loadCanalConfig()
getClustersAndServers().then((res) => {
this.options = res.data
})
},
methods: {
editorInit() {
@@ -50,11 +61,12 @@ export default {
this.form.id = data.id
this.form.name = data.name + '/instance.propertios'
this.form.content = data.content
this.form.clusterServerId = data.clusterServerId
})
},
onSubmit() {
this.$confirm(
'修改Canal实例配置可能会导致实例重启,是否继续?',
'修改Instance配置可能会导致重启,是否继续?',
'确定修改',
{
confirmButtonText: '确定',
@@ -0,0 +1,459 @@
<template>
<div class="app-container">
<div class="filter-container">
<!--<el-input v-model="listQuery.name" placeholder="Server 名称" style="width: 200px;" class="filter-item" />-->
<el-select v-model="listQuery.clusterId" placeholder="所属集群" class="filter-item">
<el-option key="" label="所属集群" value="" />
<el-option key="-1" label="单机" value="-1" />
<el-option v-for="item in canalClusters" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
<el-input v-model="listQuery.ip" placeholder="Server IP" style="width: 200px;" class="filter-item" />
<el-button class="filter-item" type="primary" icon="el-icon-search" plain @click="queryData()">查询</el-button>
<el-button class="filter-item" type="primary" @click="handleCreate()">新建Server</el-button>
<el-button class="filter-item" type="info" @click="fetchData()">刷新列表</el-button>
</div>
<el-table
v-loading="listLoading"
:data="list"
element-loading-text="Loading"
border
fit
highlight-current-row
>
<el-table-column label="所属集群" min-width="200" align="center">
<template slot-scope="scope">
<span v-if="scope.row.canalCluster !== null">
{{ scope.row.canalCluster.name }}
</span>
<span v-else>
-
</span>
</template>
</el-table-column>
<el-table-column label="Server 名称" min-width="200" align="center">
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column label="Server IP" min-width="200" align="center">
<template slot-scope="scope">
<span>{{ scope.row.ip }}</span>
</template>
</el-table-column>
<el-table-column label="admin 端口" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.adminPort }}
</template>
</el-table-column>
<el-table-column label="tcp 端口" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.tcpPort }}
</template>
</el-table-column>
<el-table-column label="metric 端口" min-width="100" align="center">
<template slot-scope="scope">
{{ scope.row.metricPort }}
</template>
</el-table-column>
<el-table-column class-name="status-col" label="状态" min-width="150" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.status | statusFilter">{{ scope.row.status | statusLabel }}</el-tag>
</template>
</el-table-column>
<el-table-column align="center" prop="created_at" label="操作" min-width="150">
<template slot-scope="scope">
<el-dropdown trigger="click">
<el-button type="primary" size="mini">
操作<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleConfig(scope.row)">配置</el-dropdown-item>
<el-dropdown-item @click.native="handleUpdate(scope.row)">修改</el-dropdown-item>
<el-dropdown-item @click.native="handleDelete(scope.row)">删除</el-dropdown-item>
<el-dropdown-item @click.native="handleStart(scope.row)">启动</el-dropdown-item>
<el-dropdown-item @click.native="handleStop(scope.row)">停止</el-dropdown-item>
<el-dropdown-item @click.native="handleInstances(scope.row)">详情</el-dropdown-item>
<el-dropdown-item @click.native="handleLog(scope.row)">日志</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
<pagination v-show="count>0" :total="count" :page.sync="listQuery.page" :limit.sync="listQuery.size" @pagination="fetchData()" />
<el-dialog :visible.sync="dialogFormVisible" :title="textMap[dialogStatus]" width="600px">
<el-form ref="dataForm" :rules="rules" :model="nodeModel" label-position="left" label-width="120px" style="width: 400px; margin-left:30px;">
<el-form-item label="所属集群" prop="clusterId">
<el-select v-if="dialogStatus === 'create'" v-model="nodeModel.clusterId" placeholder="选择所属集群">
<el-option key="" label="单机" value="" />
<el-option v-for="item in canalClusters" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
<el-select v-else v-model="nodeModel.clusterId" placeholder="选择所属集群" disabled="disabled">
<el-option key="" label="单机" value="" />
<el-option v-for="item in canalClusters" :key="item.id" :label="item.name" :value="item.id" />
</el-select>
</el-form-item>
<el-form-item label="Server 名称" prop="name">
<el-input v-model="nodeModel.name" />
</el-form-item>
<el-form-item label="Server IP" prop="ip">
<el-input v-model="nodeModel.ip" />
</el-form-item>
<el-form-item label="admin 端口" prop="adminPort">
<el-input v-model="nodeModel.adminPort" placeholder="11110" type="number" />
</el-form-item>
<el-form-item label="tcp 端口" prop="tcpPort">
<el-input v-model="nodeModel.tcpPort" placeholder="11111" type="number" />
</el-form-item>
<el-form-item label="metric 端口" prop="metricPort">
<el-input v-model="nodeModel.metricPort" placeholder="11112" type="number" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">取消</el-button>
<el-button type="primary" @click="dataOperation()">确定</el-button>
</div>
</el-dialog>
<el-dialog :visible.sync="dialogInstances" title="instance 列表" width="800px">
<div class="filter-container">
<el-button class="filter-item" type="info" @click="activeInstances()">刷新列表</el-button>
</div>
<el-table
v-loading="listLoading2"
:data="instanceList"
element-loading-text="Loading"
border
fit
highlight-current-row
>
<el-table-column label="Instance 名称" min-width="200" align="center">
<template slot-scope="scope">
{{ scope.row.name }}
</template>
</el-table-column>
<el-table-column label="状态" min-width="200" align="center">
<template slot-scope="scope">
<el-tag :type="scope.row.runningStatus | statusFilter">{{ scope.row.runningStatus | statusLabel }}</el-tag>
</template>
</el-table-column>
<el-table-column label="操作" min-width="200" align="center">
<template slot-scope="scope">
<el-dropdown trigger="click">
<el-button type="primary" size="mini">
操作<i class="el-icon-arrow-down el-icon--right" />
</el-button>
<el-dropdown-menu slot="dropdown">
<el-dropdown-item @click.native="handleStartInstance(scope.row)">启动</el-dropdown-item>
<el-dropdown-item @click.native="handleStopInstance(scope.row)">停止</el-dropdown-item>
</el-dropdown-menu>
</el-dropdown>
</template>
</el-table-column>
</el-table>
</el-dialog>
</div>
</template>
<script>
import { addNodeServer, getNodeServers, updateNodeServer, deleteNodeServer, startNodeServer, stopNodeServer } from '@/api/nodeServer'
import { getActiveInstances, stopInstance, startInstance } from '@/api/canalInstance'
import { getCanalClusters } from '@/api/canalCluster'
import Pagination from '@/components/Pagination'
export default {
components: { Pagination },
filters: {
statusFilter(status) {
const statusMap = {
'1': 'success',
'0': 'gray',
'-1': 'danger'
}
return statusMap[status]
},
statusLabel(status) {
const statusMap = {
'1': '启动',
'0': '停止',
'-1': '断开'
}
return statusMap[status]
}
},
data() {
return {
list: null,
instanceList: null,
listLoading: true,
listLoading2: true,
serverIdTmp: null,
canalClusters: [],
count: 0,
listQuery: {
name: '',
ip: '',
clusterId: null,
page: 1,
size: 20
},
dialogFormVisible: false,
dialogInstances: false,
textMap: {
create: '新建Server信息',
update: '修改Server信息'
},
nodeModel: {
id: undefined,
clusterId: null,
name: null,
ip: null,
adminPort: 11110,
tcpPort: 11111,
metricPort: 11112
},
rules: {
name: [{ required: true, message: 'Server 名称不能为空', trigger: 'change' }],
ip: [{ required: true, message: 'Server IP不能为空', trigger: 'change' }],
adminPort: [{ required: true, message: 'Server admin端口不能为空', trigger: 'change' }]
},
dialogStatus: 'create'
}
},
// { min: 2, max: 5, message: '长度在 2 到 5 个字符', trigger: 'change' }
created() {
getCanalClusters().then((res) => {
this.canalClusters = res.data
})
if (this.$route.query.clusterId) {
try {
this.listQuery.clusterId = Number(this.$route.query.clusterId)
} catch (e) {
console.log(e)
}
}
this.fetchData()
},
methods: {
fetchData() {
this.listLoading = true
getNodeServers(this.listQuery).then(res => {
this.list = res.data.items
this.count = res.data.count
}).finally(() => {
this.listLoading = false
})
},
queryData() {
this.listQuery.page = 1
this.fetchData()
},
resetModel() {
this.nodeModel = {
id: undefined,
clusterId: null,
name: null,
ip: null,
adminPort: null,
tcpPort: null,
metricPort: null
}
},
handleCreate() {
this.resetModel()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
handleInstances(row) {
this.serverIdTmp = row.id
this.activeInstances()
},
activeInstances() {
this.listLoading2 = true
this.dialogInstances = true
getActiveInstances(this.serverIdTmp).then(res => {
this.instanceList = res.data
}).finally(() => {
this.listLoading2 = false
})
},
dataOperation() {
this.$refs['dataForm'].validate((valid) => {
if (valid) {
if (this.dialogStatus === 'create') {
addNodeServer(this.nodeModel).then(res => {
this.operationRes(res)
})
}
if (this.dialogStatus === 'update') {
updateNodeServer(this.nodeModel).then(res => {
this.operationRes(res)
})
}
}
})
},
operationRes(res) {
if (res.data === 'success') {
this.fetchData()
this.dialogFormVisible = false
this.$message({
message: this.textMap[this.dialogStatus] + '成功',
type: 'success'
})
} else {
this.$message({
message: this.textMap[this.dialogStatus] + '失败',
type: 'error'
})
}
},
handleConfig(row) {
if (row.canalCluster !== null) {
this.$message({ message: '集群模式Server不允许单独变更配置,请在集群配置变更', type: 'error' })
return
}
this.$router.push('/canalServer/nodeServer/config?serverId=' + row.id)
},
handleUpdate(row) {
this.resetModel()
this.nodeModel = Object.assign({}, row)
this.dialogStatus = 'update'
this.dialogFormVisible = true
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
},
handleDelete(row) {
this.$confirm('删除Server信息会导致节点服务停止', '确定删除Server信息', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
deleteNodeServer(row.id).then((res) => {
if (res.data === 'success') {
this.fetchData()
this.$message({
message: '删除Server信息成功',
type: 'success'
})
} else {
this.$message({
message: '删除Server信息失败',
type: 'error'
})
}
})
})
},
handleStart(row) {
if (row.status !== '0') {
this.$message({ message: '当前Server不是停止状态,无法启动', type: 'error' })
return
}
this.$confirm('启动Server服务', '确定启动Server服务', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
startNodeServer(row.id).then((res) => {
if (res.data) {
this.fetchData()
this.$message({
message: '启动成功',
type: 'success'
})
} else {
this.$message({
message: '启动Server服务出现异常',
type: 'error'
})
}
})
})
},
handleStop(row) {
if (row.status !== '1') {
this.$message({ message: '当前Server不是启动状态,无法停止', type: 'error' })
return
}
this.$confirm('停止Server服务会导致所有Instance都停止服务', '确定停止Server服务', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
stopNodeServer(row.id).then((res) => {
if (res.data) {
this.fetchData()
this.$message({
message: '停止成功',
type: 'success'
})
} else {
this.$message({
message: '停止Server服务出现异常',
type: 'error'
})
}
})
})
},
handleLog(row) {
this.$router.push('nodeServer/log?id=' + row.id)
},
handleStartInstance(row) {
if (row.runningStatus !== '0') {
this.$message({ message: '当前Instance不是停止状态,无法启动', type: 'error' })
return
}
this.$confirm('启动Instance服务', '确定启动Instance服务', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
startInstance(row.id, this.serverIdTmp).then((res) => {
if (res.data) {
this.activeInstances()
this.$message({
message: '启动成功, 稍后请刷新列表查看状态',
type: 'success'
})
} else {
this.$message({
message: '启动Instance服务出现异常',
type: 'error'
})
}
})
})
},
handleStopInstance(row) {
if (row.runningStatus !== '1') {
this.$message({ message: '当前Instance不是运行状态,无法停止', type: 'error' })
return
}
this.$confirm('集群模式下停止实例其它主机将会抢占执行该实例', '停止 Instance 服务', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
stopInstance(row.id, this.serverIdTmp).then((res) => {
if (res.data) {
this.activeInstances()
this.$message({
message: '停止成功, 稍后请刷新列表查看状态',
type: 'success'
})
} else {
this.$message({
message: '停止Instance服务出现异常',
type: 'error'
})
}
})
})
}
}
}
</script>

Some files were not shown because too many files have changed in this diff Show More